当前位置: 首页>>代码示例>>PHP>>正文


PHP Term::model方法代码示例

本文整理汇总了PHP中Term::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Term::model方法的具体用法?PHP Term::model怎么用?PHP Term::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Term的用法示例。


在下文中一共展示了Term::model方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionList

 public function actionList()
 {
     $title = 'Sản phẩm';
     $criteria = new CDbCriteria(array('condition' => 'status<>0', 'order' => 'count_buy DESC'));
     if ($_GET['catid']) {
         $criteria->addCondition('`cat_id` =' . $_GET['catid']);
         $term = Term::model()->findByPk($_GET['catid']);
         $title = $term->name;
     }
     $dataProvider = new CActiveDataProvider('Product', array('pagination' => array('pageSize' => Yii::app()->params['itemsPerPage']), 'criteria' => $criteria));
     $thuongHieu = Term::model()->findAll('vid=7');
     $thItems = array();
     if ($thuongHieu) {
         foreach ($thuongHieu as $thItem) {
             $thItems[] = array('title' => $thItem['name'], 'value' => $thItem['id'], 'checked' => false);
         }
     }
     $cat = Term::model()->findAll('vid=6');
     $catItems = array();
     if ($cat) {
         foreach ($cat as $thItem) {
             $catItems[] = array('title' => $thItem['name'], 'value' => $thItem['id'], 'checked' => false);
         }
     }
     $this->render('list', array('items' => $dataProvider, 'title' => $title, 'thItems' => $thItems, 'catItems' => $catItems));
 }
开发者ID:ngdvan,项目名称:lntguitar,代码行数:26,代码来源:ProductController.php

示例2: renderContent

 protected function renderContent()
 {
     $extra = '';
     if (isset($_GET['c'])) {
         $url = array('/song/index', 'c' => $_GET['c']);
     } else {
         $url = array('/song/index');
     }
     $terms = Term::model()->findAll('vid = 4');
     $menuItems[] = array('label' => 'Tất cả', 'url' => $url, 'active' => !isset($_GET['c']) && !isset($_GET['tid']) ? true : false);
     foreach ($terms as $term) {
         if (isset($_GET['c'])) {
             $url = array('/song/index', 'tid' => $term->id, 'c' => $_GET['c']);
         } else {
             $url = array('/song/index', 'tid' => $term->id);
         }
         $menuItems[] = array('label' => $term->name, 'url' => $url);
     }
     $this->widget('zii.widgets.CMenu', array('items' => $menuItems, 'activateItems' => true));
 }
开发者ID:ngdvan,项目名称:lntguitar,代码行数:20,代码来源:SongFilter.php

示例3: renderContent

 protected function renderContent()
 {
     /*$items = array(
           array('label' => 'Tất cả', 'url' => array('video/index')),
           array('label' => 'Mới nhất', 'url' => array('video/list', 'filter' => 'latest')),
           array('label' => 'Xem nhiều nhất', 'url' => array('video/list', 'filter' => 'top_view')),
           array('label' => 'Bình chọn nhiều nhất', 'url' => array('video/list', 'filter' => 'top_like')),
       );*/
     $terms = Term::model()->findAll('vid = 2 AND parent = 0');
     foreach ($terms as $term) {
         $item = array('label' => $term->name, 'url' => array('video/catlist', 'catid' => $term->id, 'catname' => Lnt::safeTitle($term->name)));
         $items[] = $item;
         $subTerms = Term::model()->findAll('vid = 2 AND parent = ' . $term->id);
         if ($subTerms) {
             foreach ($subTerms as $sTerm) {
                 $items[] = array('itemOptions' => array('class' => 'sub'), 'label' => $sTerm->name, 'url' => array('video/catlist', 'catid' => $sTerm->id, 'catname' => Lnt::safeTitle($sTerm->name)));
             }
         }
     }
     echo "<div style='margin: 10px 0px;color: #000000;\n    font-weight: bold;\n    text-align: left;\n    text-transform: uppercase;'>Danh mục</div>";
     $this->widget('zii.widgets.CMenu', array('items' => $items, 'activateItems' => true));
 }
开发者ID:ngdvan,项目名称:lntguitar,代码行数:22,代码来源:VideoCategories.php

示例4: renderContent

 protected function renderContent()
 {
     $id = isset($_GET['id']) ? (int) $_GET['id'] : 0;
     $model = GxcHelpers::loadDetailModel('Taxonomy', $id);
     //The type of the content we want to create
     $type = $model->type;
     //Guid of the Object
     $guid = $model->guid;
     //List of language that should exclude not to translate
     $lang_exclude = array();
     //List of translated versions
     $versions = array();
     $list_items = array();
     //Look for the Term Items belong to this Taxonomy
     $list_terms = Term::model()->findAll(array('select' => '*', 'condition' => 'taxonomy_id=:id', 'order' => 't.parent ASC, t.order ASC, t.term_id ASC', 'params' => array(':id' => $id)));
     if ($list_terms) {
         foreach ($list_terms as $term) {
             $temp_item['id'] = $term->term_id;
             $temp_item['name'] = CHtml::encode($term->name);
             $temp_item['parent'] = $term->parent;
             //Add Item here to make sure Chrome not change the order of Json Object
             $list_items['item_' . $term->term_id] = $temp_item;
         }
     }
     // if it is ajax validation request
     if (isset($_POST['ajax']) && $_POST['ajax'] === 'taxonomy-form') {
         echo CActiveForm::validate($model);
         Yii::app()->end();
     }
     // collect user input data
     if (isset($_POST['Taxonomy'])) {
         $model->attributes = $_POST['Taxonomy'];
         if ($model->save()) {
             user()->setFlash('success', t('cms', 'Update Taxonomy Successfully!'));
         }
     }
     $this->render('cmswidgets.views.taxonomy.taxonomy_form_widget', array('model' => $model, 'lang_exclude' => $lang_exclude, 'versions' => $versions, 'type' => $type, 'list_items' => $list_items));
 }
开发者ID:pramana08,项目名称:GXC-CMS-2,代码行数:38,代码来源:TaxonomyUpdateWidget.php

示例5:

        <?php 
/*        //echo $form->textField($model, 'file_path', array('maxlength' => 255));
    echo $form->fileField($model, 'file_path');
    */
?>
        <?php 
/*echo $form->error($model, 'file_path'); */
?>
    </div>-->
    <!-- row -->
    <div class="row">
        <?php 
echo $form->labelEx($model, 'term_id');
?>
        <?php 
echo $form->dropDownList($model, 'term_id', GxHtml::listDataEx(Term::model()->findAllAttributes(null, true, 'vid=2')));
?>
        <?php 
echo $form->error($model, 'term_id');
?>
    </div>
    <!-- row -->
    <div class="row">
        <?php 
echo $form->labelEx($model, 'teacher_id');
?>
        <?php 
echo $form->dropDownList($model, 'teacher_id', GxHtml::listDataEx(Teacher::model()->findAllAttributes(null, true)));
?>
        <?php 
echo $form->error($model, 'teacher_id');
开发者ID:ngdvan,项目名称:lntguitar,代码行数:31,代码来源:_form.php

示例6: array

<?php

$this->breadcrumbs = array("Hợp âm");
$this->menu = array(array('label' => 'Danh sách', 'url' => array('admin')), array('label' => 'Tạo mới', 'url' => array('create')));
?>

<h1><?php 
echo "Quản lý hợp âm";
?>
</h1>


<?php 
function getLyricLink($hopam)
{
    return CHtml::link("Download", Yii::app()->createUrl('hopam/download', array('path' => $hopam->lyrics)));
}
$this->widget('zii.widgets.grid.CGridView', array('id' => 'hopam-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array(array('name' => 'id', 'htmlOptions' => array('width' => '5%')), 'title', array('name' => 'lyrics', 'value' => 'getLyricLink($data)', 'type' => 'html', 'htmlOptions' => array('width' => '5%'), 'filter' => false), array('name' => 'tid', 'value' => 'GxHtml::valueEx($data->t)', 'filter' => GxHtml::listDataEx(Term::model()->findAllAttributes(null, true, 'vid=3'))), array('name' => 'view', 'htmlOptions' => array('width' => '10%')), array('name' => 'ban_artist'), array('class' => 'CButtonColumn', 'template' => '{update}{delete}'))));
开发者ID:ngdvan,项目名称:lntguitar,代码行数:18,代码来源:admin.php

示例7: renderContent

 protected function renderContent()
 {
     //Get some pre value from URL
     //The type of the content we want to create
     $type = isset($_GET['type']) ? strtolower(trim($_GET['type'])) : '';
     //If it has guid, it means this is a translated version
     $guid = isset($_GET['guid']) ? strtolower(trim($_GET['guid'])) : '';
     //Get the list of Content Type
     $types = GxcHelpers::getAvailableContentType();
     //List of language that should exclude not to translate
     $lang_exclude = array();
     //List of translated versions
     $versions = array();
     //Available Terms for this Object Type
     $terms = array();
     //Selected Terms
     $selected_terms = array();
     //Get Term Order
     $term_orders = ConstantDefine::getTermOrder();
     //If $type is empty then redirect to choose content type page
     if ($type != '') {
         //Check if the type appear in content type Definition
         if (array_key_exists($type, $types)) {
             // If the guid is not empty, it means we are creating a translated version of a content
             // We will exclude the translated language and include the name of the translated content to $versions
             if ($guid != '') {
                 $temp_object = Object::model()->findAll('guid=:gid', array(':gid' => $guid));
                 if (count($temp_object) > 0) {
                     foreach ($temp_object as $obj) {
                         $lang_exclude[] = $obj->lang;
                         $langs = GxcHelpers::getAvailableLanguages();
                         $versions[] = $obj->object_name . ' - ' . $langs[$obj->lang]['name'];
                     }
                 }
             }
             //Import the Content Type Class
             Yii::import('common.content_type.' . $type . '.' . $types[$type]['class']);
             //Init the class
             $typeClassObj = new $types[$type]['class']();
             $content_resources = $typeClassObj->Resources();
             //We start to implement the checking Permission HERE
             $param_content_check = array();
             $data_content_check = array();
             $param_content_check['type'] = $type;
             if (GxcContentPermission::checkCreatePermission($param_content_check, $data_content_check, $typeClassObj->Permissions())) {
                 $param_content_check['new_content'] = true;
                 $content_status = GxcContentPermission::getContentStatus($param_content_check, $data_content_check, $typeClassObj->Permissions());
                 $model = new $types[$type]['class']();
                 // Uncomment the following line if AJAX validation is needed
                 // $this->performAjaxValidation($model);
                 $model->object_date = date('Y-m-d H:i:s');
                 $model->person = '';
                 $model->guid = $guid;
                 $get_languages = GxcHelpers::loadLanguageItems($lang_exclude);
                 $available_languages = array();
                 foreach ($get_languages as $key => $value) {
                     $available_languages[] = $key;
                 }
                 //Get available Taxonomy and Terms for this Object
                 $available_taxonomy = Taxonomy::model()->findAll(' type = :type AND lang IN (' . implode(',', $available_languages) . ') ', array(':type' => $type));
                 if ($available_taxonomy) {
                     foreach ($available_taxonomy as $t) {
                         $temp = array();
                         $temp['id'] = $t->taxonomy_id;
                         $temp['lang'] = $t->lang;
                         $temp['name'] = $t->name;
                         $temp['terms'] = array();
                         //Look for the Term Items belong to this Taxonomy
                         $list_terms = Term::model()->findAll(array('select' => '*', 'condition' => 'taxonomy_id=:id', 'order' => 't.parent ASC, t.order ASC', 'params' => array(':id' => $t->taxonomy_id)));
                         if ($list_terms) {
                             foreach ($list_terms as $term) {
                                 $temp_item['id'] = $term->term_id;
                                 $temp_item['name'] = CHtml::encode($term->name);
                                 $temp_item['parent'] = $term->parent;
                                 $temp['terms']['item_' . $term->term_id] = $temp_item;
                             }
                         }
                         $terms[$t->taxonomy_id] = $temp;
                     }
                 }
                 if (isset($_POST[$types[$type]['class']])) {
                     $model->attributes = $_POST[$types[$type]['class']];
                     //Convert the date time publish to timestamp
                     $model->object_date = strtotime($model->object_date);
                     $model->object_date_gmt = local_to_gmt($model->object_date);
                     //Check which button the User click To Send to person or group
                     $button = $_POST['which_button'];
                     $trans = new Transfer();
                     // Get the Terms that the User Choose
                     //
                     $post_terms = isset($_POST['terms']) ? $_POST['terms'] : array();
                     $selected_terms = array();
                     if (!empty($post_terms)) {
                         foreach ($post_terms as $t) {
                             $t = explode('_', $t);
                             if (!isset($selected_terms[$t[1]])) {
                                 $selected_temp = array();
                                 $selected_temp['id'] = $terms[$t[1]]['id'];
                                 $selected_temp['lang'] = $terms[$t[1]]['lang'];
                                 $selected_temp['name'] = $terms[$t[1]]['name'];
//.........这里部分代码省略.........
开发者ID:pramana08,项目名称:GXC-CMS-2,代码行数:101,代码来源:ObjectCreateWidget.php

示例8: ReBindValueForMenuType

 public static function ReBindValueForMenuType($type, $value)
 {
     $result = '';
     switch ($type) {
         case ConstantDefine::MENU_TYPE_PAGE:
             $page = Page::model()->findByPk($value);
             if ($page) {
                 $result = $page->name;
             }
             break;
         case ConstantDefine::MENU_TYPE_TERM:
             $term = Term::model()->findByPk($value);
             if ($term) {
                 $result = $term->name;
             }
             break;
     }
     return $result;
 }
开发者ID:pramana08,项目名称:GXC-CMS-2,代码行数:19,代码来源:MenuItem.php

示例9: findNextOrder

 protected function findNextOrder($parentId, $term)
 {
     $criteria = new CDbCriteria();
     $criteria->order = 't.ordering DESC';
     if ($parentId > 0) {
         $criteria->join = 'INNER JOIN ' . SITE_ID . '_taxonomy_term_hierarchy th ON th.term_id = t.id';
         $criteria->compare('th.parent_id', $parentId);
     } else {
         $criteria->compare('t.v_id', $term->v_id);
         $criteria->addCondition('t.id NOT IN (SELECT term_id FROM ' . SITE_ID . '_taxonomy_term_hierarchy)');
     }
     $orderModel = Term::model()->find($criteria);
     return is_object($orderModel) ? (int) $orderModel->ordering : 0;
 }
开发者ID:hung5s,项目名称:yap,代码行数:14,代码来源:TermApi.php

示例10: getTerms

 /**
  * get root term by vocabulary id
  * 
  * @param int $type vocabulary IDs
  * 
  * @return array Term
  */
 protected function getTerms($type)
 {
     $criteria = new CDbCriteria();
     $criteria->compare('v_id', $type);
     return Term::model()->findAll($criteria);
 }
开发者ID:hung5s,项目名称:yap,代码行数:13,代码来源:AdminAtion.php

示例11: actionCatlist

 public function actionCatlist()
 {
     $criteria = new CDbCriteria(array('condition' => 't.status=1', 'order' => 't.create_time DESC'));
     if (isset($_GET['catid'])) {
         $criteria->addSearchCondition('term_id', $_GET['catid']);
         /**
          * @var $cat Term
          */
         $cat = Term::model()->findByPk($_GET['catid']);
         $title = $cat->name;
         $subTerms = Term::model()->findAll('parent=' . $_GET['catid']);
         if ($subTerms) {
             $sTerms = array();
             foreach ($subTerms as $term) {
                 $sTerms[] = $term->id;
             }
             $criteria->addInCondition("term_id", $sTerms, 'OR');
         }
     } else {
         $title = 'Tất cả Video';
     }
     $dataProvider = new CActiveDataProvider('Video', array('pagination' => array('pageSize' => Yii::app()->params['postsPerPage']), 'criteria' => $criteria));
     /*if($_GET['filter']){
           $sort = new CSort();
           $sort->attributes = array(
               'linkCountSort' => array(
                   'asc' => '(SELECT count(id) FROM {like}
                    WHERE nid = t.author_id) ASC',
                   'desc' => '(SELECT count(posts.id) FROM posts
                    WHERE posts.author_id = t.author_id) DESC',
               ));
           $dataProvider->sort = $sort;
       }*/
     $this->render('list', array('dataProvider' => $dataProvider, 'title' => $title));
 }
开发者ID:ngdvan,项目名称:lntguitar,代码行数:35,代码来源:VideoController.php

示例12: array

        <?php 
echo $form->labelEx($model, 'province_id');
?>
        <?php 
echo $form->dropDownList($model, 'province_id', CMap::mergeArray(array(0 => 'Chọn tỉnh/tp'), GxHtml::listDataEx(Term::model()->findAllAttributes(null, true, 'vid=5 AND parent = 0'))));
?>
        <?php 
echo $form->error($model, 'province_id');
?>
    </div>
		<div class="row">
		<?php 
echo $form->labelEx($model, 'district_id');
?>
            <?php 
echo $form->dropDownList($model, 'district_id', CMap::mergeArray(array(0 => 'Chọn quận/huyện'), $model->province_id ? GxHtml::listDataEx(Term::model()->findAllAttributes(null, true, 'vid=5 AND parent = ' . $model->province_id)) : array()));
?>
		<?php 
echo $form->error($model, 'district_id');
?>
		</div><!-- row -->

		<label><?php 
//echo GxHtml::encode($model->getRelationLabel('classGuitars'));
?>
</label>
<!--		--><?php 
//echo $form->checkBoxList($model, 'classGuitars', GxHtml::encodeEx(GxHtml::listDataEx(ClassGuitar::model()->findAllAttributes(null, true)), false, true));
?>

<?php 
开发者ID:ngdvan,项目名称:lntguitar,代码行数:31,代码来源:_form.php

示例13: getImage

Yii::import('application.extensions.image.Image');
function getImage($image)
{
    if ($image) {
        $thumbImage = new Image(Yii::getPathOfAlias('webroot') . '/' . $image);
        $img_url = $thumbImage->createThumb(110, 70);
        return CHtml::image($img_url);
    }
}
$this->breadcrumbs = array('Sản phẩm' => array('admin'), Yii::t('app', 'Quản lý'));
$this->menu = array(array('label' => 'Danh sách', 'url' => array('admin')), array('label' => 'Tạo mới', 'url' => array('create')));
Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$.fn.yiiGridView.update('product-grid', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n");
?>

<h1>Quản lý sản phẩm</h1>
<?php 
/*echo GxHtml::link(Yii::t('app', 'Tìm kiếm nâng cao'), '#', array('class' => 'search-button')); */
?>
<!--
<div class="search-form">
    <?php 
/*$this->renderPartial('_search', array(
    'model' => $model,
)); */
?>
</div><!-- search-form -->

<?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'product-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array('title', 'code', array('name' => 'price', 'value' => 'number_format($data->price,0,",",".")." đ"'), array('name' => 'image', 'value' => 'getImage($data->image)', 'type' => 'html'), array('name' => 'cat_id', 'value' => 'GxHtml::valueEx($data->cat)', 'filter' => GxHtml::listDataEx(Term::model()->findAllAttributes(null, true, 'vid=6'))), array('name' => 'th_id', 'value' => 'GxHtml::valueEx($data->th)', 'filter' => GxHtml::listDataEx(Term::model()->findAllAttributes(null, true, 'vid=7'))), array('name' => 'status', 'value' => 'GxHtml::valueEx($data->status)', 'filter' => array('Ẩn', 'Hiện', 'Hết hàng')), array('class' => 'CButtonColumn', 'template' => '{update}{delete}'))));
开发者ID:ngdvan,项目名称:lntguitar,代码行数:29,代码来源:admin.php

示例14: getTerms

 /**
  * get all terms of current object
  * 
  * @param int $vstate vocabulary state
  * @param int $state term state
  * @return array Term
  */
 public function getTerms($vstate = Vocabulary::STATE_ACTIVE, $state = Term::STATE_ACTIVE)
 {
     $criteria = new CDbCriteria();
     $criteria->join = "INNER JOIN " . SITE_ID . '_' . "taxonomy_vocabulary tv ON tv.id = t.v_id" . "\n INNER JOIN " . SITE_ID . '_' . "taxonomy_index ti ON ti.term_id = t.id";
     if (is_numeric($this->taxonomy)) {
         $criteria->compare('tv.id', $this->taxonomy);
     } else {
         $criteria->compare('tv.alias', $this->taxonomy);
     }
     $criteria->compare('tv.module', $this->module);
     $criteria->compare('tv.state', $vstate);
     $criteria->compare('t.state', $state);
     $objectId = (int) $this->getOwner()->{$this->objectAttribute};
     if ($objectId) {
         $criteria->compare('ti.object_id', $objectId);
     }
     return Term::model()->findAll($criteria);
 }
开发者ID:hung5s,项目名称:yap,代码行数:25,代码来源:TaxonomyBehavior.php

示例15: getProperty

 /**
  * get property of Term
  *
  * @param int $id term ID
  * @param string $propertyClassName Class Name of property class
  *
  * @return Object|string
  */
 protected function getProperty($id, $propertyClassName)
 {
     $property = '';
     if (empty($propertyClassName) === false) {
         if ($id) {
             $property = Term::model($propertyClassName)->findByAttributes(array('term_id' => $id));
         }
         if (!isset($property) || !is_object($property)) {
             $property = new $propertyClassName();
         }
         if (isset($property->xml)) {
             $property->xml = base64_decode($property->xml);
         }
     }
     return $property;
 }
开发者ID:hung5s,项目名称:yap,代码行数:24,代码来源:UpdateAtion.php


注:本文中的Term::model方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。