本文整理汇总了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'));
}
示例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();
}
示例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.");
}
}
示例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));
}
}
示例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]);
}
}
示例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>