本文整理匯總了PHP中Note::getTypeNames方法的典型用法代碼示例。如果您正苦於以下問題:PHP Note::getTypeNames方法的具體用法?PHP Note::getTypeNames怎麽用?PHP Note::getTypeNames使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Note
的用法示例。
在下文中一共展示了Note::getTypeNames方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testExtension
/**
* Tests functions related to note extension.
*/
public function testExtension()
{
$note1 = $this->notes('note1');
$note2 = $this->notes('note2');
$note3 = $this->notes('note3');
$allowedTypes = Note::getAllowedTypes();
$this->assertEquals(3, count($allowedTypes));
$this->assertTrue(in_array(array('extension' => 'pdf', 'name' => 'PDF'), $allowedTypes));
$this->assertTrue(in_array(array('extension' => 'jpg', 'name' => 'Gambar'), $allowedTypes));
$this->assertTrue(in_array(array('extension' => 'htm', 'name' => 'Teks'), $allowedTypes));
$this->assertEquals('pdf', $note1->getExtension());
$this->assertEquals('jpg', $note2->getExtension());
$this->assertEquals('htm', $note3->getExtension());
$this->assertFileExists($note1->getTypeIcon());
$this->assertFileExists($note2->getTypeIcon());
$this->assertFileExists($note3->getTypeIcon());
$typeNames = Note::getTypeNames();
$this->assertEquals(3, count($typeNames));
$this->assertTrue(in_array('PDF', $typeNames));
$this->assertTrue(in_array('Gambar', $typeNames));
$this->assertTrue(in_array('Teks', $typeNames));
for ($i = 0; $i < count($allowedTypes); $i++) {
$type = $allowedTypes[$i];
$this->assertEquals($i, Note::getTypeFromExtension($type['extension']));
}
$this->assertEquals(-1, Note::getTypeFromExtension('mp3'));
}
示例2: array
<div class="field">
<?php
echo $form->label($model, 'title');
?>
<?php
echo $form->textField($model, 'title', array('size' => 100, 'maxlength' => 90));
?>
</div>
<div class="field">
<?php
echo $form->label($model, 'type');
?>
<?php
echo $form->dropDownList($model, 'type', Note::getTypeNames(), array('prompt' => '(semua)'));
?>
</div>
<div class="field">
<?php
echo $form->label($model, 'faculty_id');
?>
<?php
echo $form->dropDownList($model, 'faculty_id', CHtml::listData(Faculty::model()->findAll(), 'id', 'name'), array('prompt' => '(semua)', 'ajax' => array('type' => 'POST', 'url' => array('home/updateCourses'), 'update' => '#courses', 'data' => array('faculty_id' => 'js:this.value')), 'options' => array('1' => array('selected' => 'selected'))));
?>
</div>
<div class="field" id="courses">
<?php
echo $form->label($model, 'course_id');