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


PHP Status::depth方法代码示例

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


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

示例1: buildSqlWhere

 public function buildSqlWhere()
 {
     $where = $this->config->filter();
     $depth = Status::depth($this->statusVariables);
     if ($depth > 1) {
         if (!$this->config->connectionField()) {
             throw new \Ip\Exception("Nested GRID require 'connectionField' setting to be set.");
         }
         $where .= ' and (' . $where . ') and ' . $this->config->tableName() . '.`' . $this->config->connectionField() . '` = ' . ipDb()->getConnection()->quote($this->statusVariables['gridParentId' . ($depth - 1)]);
     }
     $searchVariables = array();
     foreach ($this->statusVariables as $key => $value) {
         if (preg_match('/^s_/', $key)) {
             $searchVariables[substr($key, 2)] = $value;
         }
     }
     if (!empty($searchVariables)) {
         foreach ($this->config->fields() as $fieldData) {
             if (!empty($fieldData['type']) && $fieldData['type'] == 'Tab') {
                 continue;
             }
             $fieldObject = $this->config->fieldObject($fieldData);
             $fieldQuery = $fieldObject->searchQuery($searchVariables);
             if ($fieldQuery) {
                 if ($where != ' ') {
                     $where .= ' and ';
                 }
                 $where .= $fieldQuery;
             }
         }
     }
     return $where;
 }
开发者ID:Umz,项目名称:ImpressPages,代码行数:33,代码来源:Db.php

示例2: getBreadcrumb

 protected function getBreadcrumb()
 {
     $depth = Status::depth($this->statusVariables);
     if ($depth <= 1) {
         return array();
     }
     $breadcrumb = array();
     $gridConfig = $this->config;
     $breadcrumb[] = array('title' => $gridConfig->getTitle(), 'url' => '#');
     $lastStatusVariables = array();
     $db = new Db($this->config, $this->statusVariables);
     for ($i = 1; $i <= $depth - 1; $i++) {
         if (isset($this->statusVariables['gridParentId' . $i])) {
             $parentId = $this->statusVariables['gridParentId' . $i];
         } else {
             $parentId = null;
         }
         if (isset($this->statusVariables['gridId' . $i])) {
             $gridId = $this->statusVariables['gridId' . $i];
         } else {
             $gridId = null;
         }
         $lastStatusVariables = Status::genSubgridVariables($lastStatusVariables, $gridId, $parentId);
         $tmpGridConfig = $gridConfig->subgridConfig($lastStatusVariables);
         $hash = Status::build($lastStatusVariables);
         $breadcrumbGridconfig = $gridConfig->subgridConfig($lastStatusVariables, $i);
         if ($breadcrumbGridconfig->getBreadcrumbField()) {
             $title = $db->breadcrumbTitle($i);
         } else {
             $title = $tmpGridConfig->getTitle();
         }
         $breadcrumb[] = array('title' => $title, 'url' => '#' . $hash);
     }
     return $breadcrumb;
 }
开发者ID:Umz,项目名称:ImpressPages,代码行数:35,代码来源:Display.php

示例3: genSubgridVariables

 public static function genSubgridVariables($curStatusVariables, $gridId, $gridParentId)
 {
     $newStatusVariables = array();
     $depth = Status::depth($curStatusVariables);
     for ($i = 1; $i < $depth; $i++) {
         $newStatusVariables['gridId' . $i] = $curStatusVariables['gridId' . $i];
         $newStatusVariables['gridParentId' . $i] = $curStatusVariables['gridParentId' . $i];
     }
     if ($gridId !== null) {
         $newStatusVariables['gridId' . $depth] = $gridId;
     }
     if ($gridParentId !== null) {
         $newStatusVariables['gridParentId' . $depth] = $gridParentId;
     }
     return $newStatusVariables;
 }
开发者ID:impresspages,项目名称:impresspages,代码行数:16,代码来源:Status.php

示例4: subgridConfig

 /**
  * Return nested grid config object
  * @param $statusVariables
  * @return Config
  * @throws \Ip\Exception
  */
 public function subgridConfig($statusVariables, $depthLimit = null)
 {
     $depth = Status::depth($statusVariables);
     if ($depthLimit !== null && $depthLimit < $depth) {
         $depth = $depthLimit;
     }
     $config = $this->config;
     for ($i = 1; $i < $depth; $i++) {
         $found = false;
         foreach ($config['fields'] as $field) {
             if (!empty($field['type']) && $field['type'] == 'Grid' && $field['gridId'] == $statusVariables['gridId' . $i]) {
                 $config = $field['config'];
                 $found = true;
                 break;
             }
         }
         if (!$found) {
             throw new \Ip\Exception('Unknown subgrid');
         }
     }
     return new self($config);
 }
开发者ID:Umz,项目名称:ImpressPages,代码行数:28,代码来源:Config.php

示例5: create

 public function create($data)
 {
     $languages = ipContent()->getlanguages();
     $fields = $this->subgridConfig->fields();
     $dbData = array();
     $languageData = array();
     foreach ($fields as $field) {
         if (!empty($field['type']) && $field['type'] == 'Tab' && empty($field['preview']) || !empty($field['ignoreDb'])) {
             continue;
         }
         $fieldObject = $this->subgridConfig->fieldObject($field);
         $fieldObject->beforeCreate(null, $data);
         //one vent for multilingual and non-multilingual fields.
         if (empty($field['multilingual'])) {
             $fieldData = $fieldObject->createData($data);
             if (!is_array($fieldData)) {
                 throw new \Ip\Exception("createData method in class " . esc(get_class($fieldObject)) . " has to return array.");
             }
             $dbData = array_merge($dbData, $fieldData);
         } else {
             foreach ($languages as $language) {
                 $tmpData = $data;
                 if (isset($data[$field['field'] . '_' . $language->getCode()])) {
                     $tmpData[$field['field']] = $data[$field['field'] . '_' . $language->getCode()];
                 }
                 $fieldObject = $this->subgridConfig->fieldObject($field);
                 $fieldData = $fieldObject->createData($tmpData);
                 if (!is_array($fieldData)) {
                     throw new \Ip\Exception("createData method in class " . esc(get_class($fieldObject)) . " has to return array.");
                 }
                 if (empty($languageData[$language->getCode()])) {
                     $languageData[$language->getCode()] = array();
                 }
                 $languageData[$language->getCode()] = array_merge($languageData[$language->getCode()], $fieldData);
             }
         }
     }
     $sortField = $this->subgridConfig->sortField();
     if ($sortField) {
         if ($this->subgridConfig->createPosition() == 'top') {
             $orderValue = ipDb()->selectValue($this->subgridConfig->rawTableName(), "MIN(`{$sortField}`)", array());
             $dbData[$sortField] = is_numeric($orderValue) ? $orderValue - 1 : 1;
             // 1 if null
         } else {
             $orderValue = ipDb()->selectValue($this->subgridConfig->rawTableName(), "MAX(`{$sortField}`)", array());
             $dbData[$sortField] = is_numeric($orderValue) ? $orderValue + 1 : 1;
             // 1 if null
         }
     }
     $depth = Status::depth($this->statusVariables);
     if ($depth > 1) {
         $dbData[$this->subgridConfig->connectionField()] = $this->statusVariables['gridParentId' . ($depth - 1)];
     }
     if ($this->subgridConfig->createFilter()) {
         $dbData = call_user_func($this->subgridConfig->createFilter(), $dbData);
     }
     if ($this->subgridConfig->isMultilingual() && $this->subgridConfig->createLanguageFilter()) {
         $languageData = call_user_func($this->subgridConfig->createLanguageFilter(), $languageData);
     }
     $recordId = ipDb()->insert($this->subgridConfig->rawTableName(), $dbData);
     if (!empty($languageData)) {
         foreach ($languageData as $languageCode => $rawData) {
             $rawData[$this->subgridConfig->languageCodeField()] = $languageCode;
             $rawData[$this->subgridConfig->languageForeignKeyField()] = $recordId;
             ipDb()->insert($this->subgridConfig->rawLanguageTableName(), $rawData);
         }
     }
     foreach ($fields as $field) {
         $fieldObject = $this->subgridConfig->fieldObject($field);
         $fieldObject->afterCreate($recordId, $data);
     }
     return $recordId;
 }
开发者ID:Umz,项目名称:ImpressPages,代码行数:73,代码来源:Actions.php


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