當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Folder::model方法代碼示例

本文整理匯總了PHP中Folder::model方法的典型用法代碼示例。如果您正苦於以下問題:PHP Folder::model方法的具體用法?PHP Folder::model怎麽用?PHP Folder::model使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Folder的用法示例。


在下文中一共展示了Folder::model方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: actionDelete

 public function actionDelete()
 {
     $page = Folder::model()->findByPk(Yii::app()->request->getParam('id'));
     if ($page !== null) {
         $page->delete();
     }
     $this->redirect(Yii::app()->createUrl('//documents/admin'));
 }
開發者ID:nilBora,項目名稱:MVC_documents_Yii,代碼行數:8,代碼來源:AdminController.php

示例2: beforeSave

 protected function beforeSave()
 {
     $folderModel = Folder::model()->findByPk($this->folder_id);
     $existingBookmarkModel = Bookmark::model()->findSingleByAttributes(array('user_id' => \GO::user()->id, 'folder_id' => $folderModel->id));
     if (!empty($existingBookmarkModel)) {
         throw new \Exception(str_replace('%fn', $folderModel->name, \GO::t('bookmarkAlreadyExists', 'files')));
     }
     return parent::beforeSave();
 }
開發者ID:ajaboa,項目名稱:crmpuan,代碼行數:9,代碼來源:Bookmark.php

示例3: NameUnique

 public function NameUnique()
 {
     $m = Folder::model()->findByAttributes(array('name' => $this->name));
     echo "<pre>";
     // print_r($m);
     if (isset($m)) {
         $this->addError("Name", "User with this name already exist and is active.");
     }
 }
開發者ID:nilBora,項目名稱:MVC_documents_Yii,代碼行數:9,代碼來源:Folder.php

示例4: run

 public function run()
 {
     $folder = array();
     $command = Yii::app()->db->createCommand("SELECT DISTINCT document.folder_id as id  FROM `content` LEFT JOIN document ON content.object_id = document.id WHERE content.`object_model`='Document' AND content.space_id=" . Yii::app()->controller->space->id)->queryAll();
     if (sizeof($command) > 0) {
         $id = array();
         foreach ($command as $one) {
             $id[] = $one['id'];
         }
         $folder = Folder::model()->findAllByPk($id);
         $this->render('folderPanel', array('folder' => $folder));
     }
 }
開發者ID:nilBora,項目名稱:MVC_documents_Yii,代碼行數:13,代碼來源:DocumentsDashboardWidget.php

示例5: testQuoting

 public function testQuoting()
 {
     $this->assertEmpty(Folder::model()->findByPk("'"));
     $this->assertEmpty(Folder::model()->ancestorsOf("'")->findAll());
     $this->assertEmpty(Folder::model()->childrenOf("'")->findAll());
     $this->assertEmpty(Folder::model()->parentOf("'")->findAll());
     $this->assertEmpty(Folder::model()->deleteNode("'"));
     $this->assertEmpty(Folder::model()->descendantsOf("'")->findAll());
     $this->assertEmpty(Folder::model()->fullPathOf("'")->findAll());
     $this->assertEmpty(Folder::model()->pathOf("'")->findAll());
     $this->assertEmpty(Folder::model()->unorderedPathOf("'")->findAll());
     /** @var Folder $folder5 */
     $folder5 = Folder::model()->findByPk(5);
     try {
         $folder5->moveTo("'");
         $this->fail();
     } catch (CDbException $e) {
         $this->assertEquals(201, $e->getCode());
     }
     $newFolder = new Folder();
     $newFolder->name = 'Folder';
     $this->assertTrue($newFolder->save());
     $this->assertEquals(1, $newFolder->appendTo("'"));
     try {
         Folder::model()->markAsRoot("'");
         $this->fail();
     } catch (CDbException $e) {
         // http://dev.mysql.com/doc/refman/5.5/en/error-messages-server.html
         $this->assertEquals('1452', $e->errorInfo[1]);
     }
 }
開發者ID:aidask,項目名稱:yii-closure-table-behavior,代碼行數:31,代碼來源:ClosureTableBehaviorTest.php

示例6: array

<?php

echo CHtml::textArea("name", "", array('id' => 'contentForm_question', 'class' => 'form-control autosize contentForm', 'rows' => '1', "tabindex" => "1", "placeholder" => Yii::t('DocumentsModule.widgets_views_pollForm', "Ask something...")));
?>

<div class="contentForm_options">
    <?php 
echo CHtml::textArea("body", "", array('id' => "contentForm_answersText", 'rows' => '5', 'style' => 'height: auto !important;', "class" => "form-control contentForm", "tabindex" => "2", "placeholder" => Yii::t('DocumentsModule.widgets_views_pollForm', "Possible answers (one per line)")));
?>
</div>

<div class="contentForm_options">
    <?php 
$models = Folder::model()->findAll();
?>

    <?php 
echo CHtml::dropDownList('selectFolder', 'name', CHtml::listData($models, 'id', 'name'), array('empty' => Yii::t('DocumentsModule.widgets_views_pollForm', "Select a folder"), 'class' => 'form-control contentForm'));
?>
</div>
開發者ID:nilBora,項目名稱:MVC_documents_Yii,代碼行數:20,代碼來源:pollForm.php


注:本文中的Folder::model方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。