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


PHP Block::model方法代码示例

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


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

示例1: loadModel

 public function loadModel($id)
 {
     if (($model = Block::model()->findByPk($id)) === null) {
         throw new CHttpException(404, 'Страница не найдена');
     }
     return $model;
 }
开发者ID:kuzmina-mariya,项目名称:gallery,代码行数:7,代码来源:BlockBackendController.php

示例2: loadModel

 public function loadModel($id, $ml = true)
 {
     if (($model = Block::model()->findByPk($id)) === null) {
         throw new CHttpException(404, Yii::t('PageModule.block', 'Page was not found!'));
     }
     return $model;
 }
开发者ID:kuzmina-mariya,项目名称:4seasons,代码行数:7,代码来源:BlockBackendController.php

示例3: run

 public function run()
 {
     $block = Block::model()->published()->with('children')->findByCode($this->code);
     if ($block === null) {
         if ($this->silent === false) {
             throw new CException(Yii::t('PageModule.block', 'Блок "{code}" не найден!', array('{code}' => $this->code)));
         }
         return;
     }
     $this->view = empty($block->template) ? $this->view : $block->template;
     $this->render($this->view, array('model' => $block, 'title' => $this->title));
 }
开发者ID:kuzmina-mariya,项目名称:4seasons,代码行数:12,代码来源:BlockWidget.php

示例4: array_diff_key

echo $model->hasErrors('parent_id') ? 'error' : '';
?>
">
        <div class="span3">
        <?php 
if (!$model->isNewRecord) {
    ?>
        <?php 
    echo $form->dropDownListRow($model, 'parent_id', array_diff_key(Block::model()->root()->getTabList(), $model->root()->getAssocList()), array('class' => 'span7 popover-help', 'empty' => 'Выберите', 'encode' => false));
    ?>
  
        <?php 
} else {
    ?>
        <?php 
    echo $form->dropDownListRow($model, 'parent_id', Block::model()->root()->getTabList(), array('class' => 'span7 popover-help', 'empty' => 'Выберите', 'encode' => false));
    ?>
          
        <?php 
}
?>
        </div>     
    </div>

    <div class="row-fluid control-group <?php 
echo $model->hasErrors('description') ? 'error' : '';
?>
">
        <?php 
echo $form->textFieldRow($model, 'description', array('size' => 60, 'maxlength' => 150, 'class' => 'span7 popover-help', 'data-original-title' => $model->getAttributeLabel('description'), 'data-content' => $model->getAttributeDescription('description')));
?>
开发者ID:kuzmina-mariya,项目名称:unizaro-kamin,代码行数:31,代码来源:_form.php

示例5: suggestBlocks

 public static function suggestBlocks()
 {
     if (isset($_GET['q']) && ($keyword = trim($_GET['q'])) !== '') {
         $limit = 10;
         $blocks = Block::model()->findAll(array('condition' => 'name LIKE :keyword', 'limit' => $limit, 'params' => array(':keyword' => '%' . strtr($keyword, array('%' => '\\%', '_' => '\\_', '\\' => '\\\\')) . '%')));
         $names = array();
         foreach ($blocks as $block) {
             $names[] = $block->name . '|' . $block->block_id;
         }
         if ($names !== array()) {
             echo implode("\n", $names);
         }
     }
     Yii::app()->end();
 }
开发者ID:ntquyen,项目名称:GXC-CMS,代码行数:15,代码来源:Block.php

示例6: initBlocks

         

    }
    
    function initBlocks(){
        
           <?php 
if (is_array($regions_blocks) && !empty($regions_blocks) > 0) {
    ?>
                    //Start to get the content based on the ids
            <?php 
    foreach ($regions_blocks as $key => $obj_blocks) {
        $blocks = array();
        for ($i = 0; $i < count($obj_blocks['id']); $i++) {
            $obj_block = $obj_blocks['id'][$i];
            $temp_block = Block::model()->findByPk($obj_block);
            if ($temp_block) {
                $count = $i + 1;
                $blocks['item_' . $count . '_' . $temp_block->block_id]['region'] = $key;
                $blocks['item_' . $count . '_' . $temp_block->block_id]['id'] = $temp_block->block_id;
                $blocks['item_' . $count . '_' . $temp_block->block_id]['title'] = $temp_block->name;
                $blocks['item_' . $count . '_' . $temp_block->block_id]['status'] = $obj_blocks['status'][$i];
            }
        }
        echo 'var block_list_region_' . $key . ' = ' . json_encode($blocks) . ';';
        echo '$.each(block_list_region_' . $key . ', function(k,v) { 
                             
                             setBlocksForRegion(v.region,v.title,v.id,v.status);              
                        });';
    }
    ?>
开发者ID:ntquyen,项目名称:GXC-CMS,代码行数:29,代码来源:page_form_widget.php

示例7: actionPaste

 public function actionPaste()
 {
     $className = $this->entity_type . 'Block';
     $id = (int) Yii::app()->user->getState('copiedBlockId');
     if (($model = Block::model()->findByPk($id)) === null) {
         $this->redirect(array('/classroom/blockBackend/index', 'entity_type' => $this->entity_type, 'entity_id' => $this->entity_id));
     }
     $criteria = new CDbCriteria();
     $criteria->select = new CDbExpression('MAX(sort) as sort');
     $criteria->condition = 't.entity_type = :entity_type AND t.entity_id = :entity_id';
     $criteria->params = array(':entity_type' => $this->entity_type, ':entity_id' => $this->entity_id);
     $max = $className::model()->find($criteria);
     $model->duplicate(array('entity_type' => $this->entity_type, 'entity_id' => $this->entity_id, 'sort' => $max->sort + 100));
     Yii::app()->user->setState('copiedBlockId', null);
     $this->redirect(array('/classroom/blockBackend/index', 'entity_type' => $this->entity_type, 'entity_id' => $this->entity_id));
 }
开发者ID:kuzmina-mariya,项目名称:happy-end,代码行数:16,代码来源:BlockBackendController.php

示例8: actionAddimages

 /**
  * Функция добавления группы изображений
  *
  * @param int $id - id-галереи
  *
  * @return void
  *
  * @throws CHttpException
  **/
 public function actionAddimages($id)
 {
     if (($gallery = Block::model()->findByPk($id)) === null) {
         throw new CHttpException(404, 'Страница не найдена');
     }
     $image = new Image();
     if (Yii::app()->getRequest()->getIsPostRequest() && ($imageData = Yii::app()->getRequest()->getPost('Image')) !== null) {
         $imageData = $imageData[$_FILES['Image']['name']['file']];
         $this->_addImage($image, $imageData, $gallery);
         if ($image->hasErrors()) {
             $data[] = array('error' => $image->getErrors());
         } else {
             $data[] = array('name' => $image->title, 'type' => $_FILES['Image']['type']['file'], 'size' => $_FILES['Image']['size']['file'], 'url' => $image->getImageUrl(), 'thumbnail_url' => $image->getImageUrl(100), 'delete_url' => $this->createUrl('/classroom/imageBackend/delete', array('id' => $image->id, 'method' => 'uploader')), 'delete_type' => 'GET');
         }
         echo json_encode($data);
         Yii::app()->end();
     } else {
         throw new CHttpException(404, 'Страница не найдена');
     }
 }
开发者ID:kuzmina-mariya,项目名称:happy-end,代码行数:29,代码来源:ImageBackendController.php

示例9: model

 public static function model($className = __CLASS__)
 {
     return parent::model($className);
 }
开发者ID:kuzmina-mariya,项目名称:happy-end,代码行数:4,代码来源:CourseBlock.php

示例10: actionSave

 public function actionSave()
 {
     $user = Yii::app()->user->getProfile();
     $quoteText = Yii::app()->getRequest()->getParam('text', null);
     if (!$quoteText === null) {
         return false;
     }
     $blockId = Yii::app()->getRequest()->getParam('blockId', null);
     if ($blockId !== null) {
         $arr = explode('-', $blockId);
         $blockId = key_exists(0, $arr) ? (int) $arr[0] : 0;
         $block = Block::model()->published()->findByPK($blockId);
         if ($block === false) {
             return false;
         }
     } else {
         return false;
     }
     // Создаем и сохраняем цитату
     $quote = new Quote();
     $quote->user_id = $user->id;
     $quote->block_id = $block->id;
     $quote->content = $quoteText;
     if ($quote->save()) {
         // Общее кол-во цитат
         $totalCount = Quote::model()->user($user->id)->program($quote->course_type_id)->count();
         // Возвращаем ответ
         $resp = array('status' => 1, 'data' => array('id' => $quote->id, 'text' => $quote->getContent(), 'url' => $quote->getUrl(), 'totalCount' => $totalCount));
         Yii::app()->ajax->raw($resp);
     } else {
         $resp = array('status' => 0, 'error' => 'Ошибка сохранения.');
         Yii::app()->ajax->raw($resp);
     }
 }
开发者ID:kuzmina-mariya,项目名称:happy-end,代码行数:34,代码来源:QuoteController.php

示例11: array_diff_key

echo Yii::t('PageModule.block', 'Fields with');
?>
    <span class="required">*</span>
    <?php 
echo Yii::t('PageModule.block', 'are required.');
?>
</div>

<?php 
echo $form->errorSummary($model);
?>

<div class="row">
    <div class="col-sm-3">
        <?php 
$parents = !$model->isNewRecord ? array_diff_key(Block::model()->root()->page($model->page_id)->getTabList(0, false), $model->root()->page($model->page_id)->getAssocList(0, false)) : Block::model()->root()->page($model->page_id)->getTabList();
echo $form->dropDownListGroup($model, 'parent_id', ['widgetOptions' => ['data' => $parents, 'htmlOptions' => ['class' => 'popover-help', 'empty' => Yii::t('PageModule.block', '--choose--'), 'data-original-title' => $model->getAttributeLabel('parent_id'), 'data-content' => $model->getAttributeDescription('parent_id'), 'encode' => false]]]);
?>
    </div>
    <div class="col-sm-3">
        <?php 
echo $form->dropDownListGroup($model, 'status', ['widgetOptions' => ['data' => $model->statusList, 'htmlOptions' => ['class' => 'popover-help', 'empty' => Yii::t('PageModule.block', '--choose--'), 'data-original-title' => $model->getAttributeLabel('status'), 'data-content' => $model->getAttributeDescription('status')]]]);
?>
    </div>
    <div class="col-sm-3">
        <?php 
echo $form->dropDownListGroup($model, 'template', ['widgetOptions' => ['data' => $this->getModule()->getBlockTemplatesList(), 'htmlOptions' => ['class' => 'popover-help', 'empty' => Yii::t('PageModule.block', '--choose--'), 'data-original-title' => $model->getAttributeLabel('template'), 'data-content' => $model->getAttributeDescription('template')]]]);
?>
    </div>
</div>
<div class="row">
开发者ID:kuzmina-mariya,项目名称:4seasons,代码行数:31,代码来源:_form.php

示例12: loadModel

 public function loadModel($id)
 {
     $model = Block::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, Yii::t('app', 'The requested page does not exist.'));
     }
     return $model;
 }
开发者ID:awecode,项目名称:awecms,代码行数:8,代码来源:BlockController.php


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