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


PHP Categories::findAll方法代码示例

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


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

示例1: buildItems

 private function buildItems()
 {
     $tpl = $this->_config['itemTemplate'];
     $hasParams = preg_match('/@\\d+@/', $tpl) != false;
     Yii::trace('hasParams=' . $hasParams);
     $cats = Categories::findAll(array_keys($this->_config['filterCategories']));
     foreach ($cats as $c) {
         if (!$c->isEmpty) {
             foreach ($c->resources as $r) {
                 $t = $tpl;
                 if ($hasParams) {
                     $params = $r->getParams();
                     if ($params !== null) {
                         $search = $replace = [];
                         foreach ($params as $p) {
                             $search[] = '@' . $p->type_id . '@';
                             $replace[] = $p->value;
                         }
                         $t = str_replace($search, $replace, $t);
                         $t = preg_replace('/@\\d+@/', '', $t);
                         //удаление лишних/не найденных
                     }
                 }
                 $this->_items[] = str_replace($this->_ph, [$r->id, $r->created, $r->alias, $r->title, $r->description, '/' . $r->route], $t);
             }
         }
     }
     return implode('', $this->_items);
 }
开发者ID:kintastish,项目名称:mobil,代码行数:29,代码来源:LinkListWidget.php

示例2: getCategoryList

 public function getCategoryList($id = 0, $l = 0)
 {
     $cat = Categories::findAll(['parent_id' => $id]);
     $list = [];
     $level = $l;
     foreach ($cat as $c) {
         //$title = $t.$c->title;
         $t = $this->getCategoryList($c->id, $level + 1);
         $list[] = ['id' => $c->id, 'title' => $c->title, 'level' => $level, 'parent' => $id, 'child_count' => count($t)];
         $list = array_merge($list, $t);
     }
     return $list;
 }
开发者ID:kintastish,项目名称:mobil,代码行数:13,代码来源:LinkListWidgetModel.php

示例3: getChilds

 private function getChilds($item_id)
 {
     $node = true;
     $childs = Categories::findAll(['parent_id' => $item_id]);
     Yii::trace('Categories count: ' . count($childs));
     if (!count($childs)) {
         $node = false;
         $childs = Resources::findAll(['category_id' => $item_id]);
         Yii::trace('Resources count: ' . count($childs));
     }
     if (!count($childs)) {
         $_items = [];
         return;
     }
     foreach ($childs as $item) {
         $this->_items[] = ['id' => $item->id, 'title' => $item->title, 'url' => '/' . $item->route, 'node' => $node];
     }
 }
开发者ID:kintastish,项目名称:mobil,代码行数:18,代码来源:ExploreController.php

示例4: actionCategories

 public function actionCategories($id)
 {
     $categories = Categories::findAll(['race_id' => $id]);
     echo "<option>Selecciona una categoría</option>";
     if ($categories) {
         foreach ($categories as $category) {
             echo "<option value='" . $category->category_id . "'>" . $category->category->name . "</option>";
         }
     }
 }
开发者ID:frankpaul142,项目名称:aurasur,代码行数:10,代码来源:UserController.php

示例5: if

$form = ActiveForm::begin();
?>

    <?php 
echo $form->field($model, 'header')->label('Заголовок:');
?>


    <?php 
echo $form->field($model, 'text')->label('Текст:')->widget(\dosamigos\tinymce\TinyMce::className(), ['options' => ['rows' => 14], 'language' => 'ru', 'clientOptions' => ['plugins' => ["advlist autolink lists link charmap print preview anchor", "searchreplace visualblocks code fullscreen", "insertdatetime media table contextmenu paste image"], 'file_browser_callback' => new yii\web\JsExpression("function(field_name, url, type, win) {\n                    if(type=='image')  \$('#file_upload_input').click();\n             }"), 'toolbar' => "undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image"]]);
?>

<div class="form-group">
    <label>Категория: </label>
    <?php 
echo Html::activeDropDownList($model, 'category_id', \yii\helpers\ArrayHelper::map(\app\models\Categories::findAll(['active' => true]), 'id', 'name'), ['class' => 'form-control']);
?>
</div>

    <?php 
echo $form->field($model, 'date')->label('Дата:')->widget(DatePicker::className(), ['model' => $model, 'attribute' => 'date', 'language' => 'ru', 'options' => ['class' => 'form-control']]);
?>



    <?php 
echo $form->field($model, 'url')->label('Url:');
?>
    <div class="form-group">
        <div class="pull-right">
            <?php 
开发者ID:hysdop,项目名称:YobaCMS,代码行数:31,代码来源:edit.php


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