私は Yii フレームワークを使用して、貧乏人のプロジェクト追跡システムを自分で構築しています。目標は、 basecamp のメモ ウィジェットに似た "crud" ウィジェット/フォームを配置して、タイトルとコンテンツ フィールドを含むメモを表示することです。(私はもはや basecamp を使用していないため、ノート ウィジェットがどのように見えるかの画像を投稿することはできません :-( )
Yii を使用して、クライアント モデルがあり、このクライアントに対応するすべてのメモを div に表示し、同じwebroot/client/view/client_id
ページでこれらのメモの CRUD 機能を使用したいと考えています。
私がオンラインで見つけた最も近い実装は、純粋に jquery jeditableで行われますが、作成および削除機能がありません。また、Yii モデル (CActiveRecord) のサポートもありません。つまり、Yii の MVC セットアップを利用せずに、コントローラ コードでデータをやり取りする必要があります。
私が今持っているもの: AJAX (forcCreation) を介して送信された非表示のフォームと、組み込みの zii ウィジェットの更新機能を利用するメモの Zii CListView ウィジェット (取得用) です$.fn.yiiListView.update('clistview_id');
が、私はむしろ立ち往生していますYii/Zii ウィジェット、jquery、またはそれらの組み合わせを使用したゲームの U および D 部分。
私の client/view.php スニペット:
<div class="note_create">
<?php echo CHtml::button('Add new note',array('class'=>'create-note-button')) ?>
<div class="create-note-form" style="display: none;">
<!-- _createNote is just a CActiveForm with a CHtml::ajaxSubmitButton-->
<?php $this->renderPartial('_createNote', array('client' => $model, 'note' => $note)); ?>
</div>
</div>
<div class="note_browser">
<?php $this->widget('zii.widgets.CListView', array(
'id' => 'clist_note_browser',
'dataProvider' => $model->noteSearch(),
'itemView' => '_note', // refers to the partial view named '_note'
'emptyText' => 'No notes found.',
'sortableAttributes' => array(
'note.title',
'note.last_modify'
),
));
?>
</div>
非常に単純なノートモデル:
<?php
/**
* This is the model class for table "note".
*
* The followings are the available columns in table 'note':
* @property string $nid
* @property string $title
* @property string $content
* @property string $first_create
* @property string $last_modify
*
* The followings are the available model relations:
* @property ClientNote $client ClientNote an intermediate table with two columns: nid, cid
*/
class Note extends CActiveRecord
{
...
public function relations()
{
return array('client' => array(self::HAS_ONE, 'ClientNote', 'nid'),);
}
...
}
誰か提案はありますか?