コード例 #1
0
ファイル: HtmlPresenter.php プロジェクト: codeagent/treemap
 /**
  * @param NodeContent $content
  * @return string
  */
 protected function contentHtml(NodeContent $content)
 {
     $html = [$content->html()];
     foreach ($content->content() as $row) {
         $html[] = "<span style='position:absolute;left:{$row[1]}px;top:{$row[2]}px;font-size:{$row[3]}px;color:{$row[4]};'>{$row[0]}</span>";
     }
     return implode("", $html);
 }
コード例 #2
0
ファイル: QueryController.php プロジェクト: hiproz/mincms
 function init()
 {
     parent::init();
     $this->getid = (int) $_GET['fid'];
     $this->active = 'node-' . $this->getid;
     $model = NodeContent::model()->findByPk($this->getid);
     $this->table = "field_" . trim($model->name);
     $this->title = __($model->discription) ?: __($model->name);
 }
コード例 #3
0
ファイル: query.php プロジェクト: hiproz/mincms
<?php

// +----------------------------------------------------------------------
// | 对自动生成的表field_{name} 生成配置文件
// +----------------------------------------------------------------------
// | Copyright (c) 2014 http://mincms.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed (http://mincms.com/licenses)
// +----------------------------------------------------------------------
// | Author: Kang Sun <*****@*****.**>
// +----------------------------------------------------------------------
$fid = (int) $_GET['fid'];
$model = NodeContent::model()->findByPk($fid);
/**
* 取得分类
*/
class Module_Node_Query
{
    static function category()
    {
        $db = Yii::app()->db->createCommand();
        $db->setFetchMode(PDO::FETCH_OBJ);
        $rows = $db->from('category')->queryAll();
        if ($rows) {
            foreach ($rows as $v) {
                $tree[$v->id] = $v;
            }
            $category = ArrHelper::tree($tree);
        }
        return array($category, $tree);
    }
コード例 #4
0
ファイル: function.php プロジェクト: hiproz/mincms
                    $value = CDB()->from($deep)->where('id=:id', array(':id' => $row[$name]))->queryRow();
                    $row[$name] = $value;
                }
            }
        }
        return $row;
    }
}
/**
* HOOK 缓存内容类型字段的结构
*/
Hook::init('init[].node_content', function () {
    if (!cache('node__content_field')) {
        Yii::import("application.modules.node.models.NodeContent");
        Yii::import("application.modules.node.models.NodeField");
        $rows = NodeContent::model()->findAll(array('order' => 'sort desc,id desc'));
        if ($rows) {
            foreach ($rows as $v) {
                $data[$v->id] = $v->name;
                $data2[$v->id] = array($v->name, $v->discription);
                $id = $v->id;
                foreach ($v->fields as $f) {
                    $field[$id]['id'] = $f->id;
                    $field[$id]['name'] = $f->name;
                    $field[$id]['type'] = $f->type;
                    $field[$id]['widget'] = $f->widget;
                    $field_table[$v->name][$f->name] = $f;
                    $d[$v->name]['id'] = 'id';
                    $d[$v->name]['vid'] = 'vid';
                    $d[$v->name]['display'] = 'display';
                    $d[$v->name]['uid'] = 'uid';
コード例 #5
0
ファイル: FieldController.php プロジェクト: hiproz/mincms
 function actionUpdate($id)
 {
     $model = NodeField::model()->findByPk($id);
     $cont = NodeContent::model()->findByPk($model->node_content_id);
     $model->display = 1;
     if (isset($_POST['NodeField'])) {
         unset($_POST['NodeField']['node_content_id']);
         $model->attributes = $_POST['NodeField'];
         $model->widget = $_POST['NodeField']['widget'];
         $model->rules = $_POST['NodeField']['rules'];
         $model->indexes = $_POST['NodeField']['indexes'];
         $model->search = $_POST['NodeField']['search'];
         $model->value = $_POST['NodeField']['value'];
         $model->type = $_POST['NodeField']['type'];
         $model->default_value = $_POST['NodeField']['default_value'];
         $model->memo = $_POST['NodeField']['memo'];
         $model->automodel = $_POST['NodeField']['automodel'];
         $model->label = $_POST['NodeField']['label'];
         $model->mvalue = $_POST['NodeField']['mvalue'];
         if ($model->save()) {
             $this->redirect(array('index', 'id' => $model->node_content_id));
         }
     }
     $this->render('create', array('model' => $model, 'cont' => $cont, 'type' => $this->type, 'id' => $model->node_content_id));
 }