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


PHP Shineisp_Commons_Utilities::array_flatten方法代码示例

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


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

示例1: simplegrid

 public function simplegrid($data)
 {
     $this->view->module = Zend_Controller_Front::getInstance()->getRequest()->getModuleName();
     $this->view->controller = Zend_Controller_Front::getInstance()->getRequest()->getControllerName();
     $this->view->action = Zend_Controller_Front::getInstance()->getRequest()->getActionName();
     if (isset($data['records'])) {
         // Name of the table, useful for the jQuery pager
         $this->view->name = !empty($data['name']) ? $data['name'] : "table_" . Shineisp_Commons_Uuid::generate();
         // Index of the table
         $this->view->id = !empty($this->view->fields[0]) && is_numeric($data['records'][0][$this->view->fields[0]]) ? $data['records'][0][$this->view->fields[0]] : "0";
         // All the records
         $this->view->records = $data['records'];
         // Create the header using the field name if the columns variable is not set
         if (empty($data['columns'])) {
             $data['columns'] = array();
             if (!empty($data['records'][0])) {
                 // Get all the fields
                 $items = Shineisp_Commons_Utilities::array_flatten($data['records'][0]);
                 $fields = array_keys($items);
                 foreach ($fields as $field) {
                     if (strpos($field, "_id") === false) {
                         // When a record is called using the HYDRATE_SCALAR mode the table aliases are attached in the field name
                         // In this way we delete the first part of the field name. For instance: o_name --> name
                         $arrfield = explode("_", $field);
                         $field = count($arrfield) > 0 ? $arrfield[count($arrfield) - 1] : $field;
                         $data['columns'][] = ucfirst(Shineisp_Registry::getInstance()->Zend_Translate->translate($field));
                     }
                 }
             }
         }
         $this->view->columns = $data['columns'];
         // If these options are true a link appear for each row in a table
         $this->view->view = !empty($data['view']) ? $data['view'] : false;
         $this->view->edit = !empty($data['edit']) ? $data['edit'] : false;
         $this->view->delete = !empty($data['delete']) ? $data['delete'] : false;
         $this->view->targetlink = !empty($data['targetlink']) ? $data['targetlink'] : null;
         // If you need more action use this parameter Array{'url'=>'name'}
         // for instance $actions['/admin/customers'] = "Customers";
         // the label customers will be translated
         $this->view->actions = !empty($data['actions']) ? $data['actions'] : false;
         $this->view->onclick = !empty($data['onclick']) ? $data['onclick'] : false;
     } else {
         $this->view->records = "";
     }
     // Path of the template
     return $this->view->render('partials/simplegrid.phtml');
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:47,代码来源:Simplegrid.php

示例2: Grid

 public function Grid($data)
 {
     $this->view->module = Zend_Controller_Front::getInstance()->getRequest()->getModuleName();
     $this->view->controller = Zend_Controller_Front::getInstance()->getRequest()->getControllerName();
     $this->view->action = Zend_Controller_Front::getInstance()->getRequest()->getActionName();
     // Create the header using the field name if the columns variable is not set
     if (empty($data['columns'])) {
         $data['columns'] = array();
         if (!empty($data['records'][0])) {
             // Get all the fields
             $items = Shineisp_Commons_Utilities::array_flatten($data['records'][0]);
             $fields = array_keys($items);
             foreach ($fields as $field) {
                 if (strpos($field, "_id") === false) {
                     // When a record is called using the HYDRATE_SCALAR mode the table aliases are attached in the field name
                     // In this way we delete the first part of the field name. For instance: o_name --> name
                     $arrfield = explode("_", $field);
                     $field = count($arrfield) > 0 ? $arrfield[count($arrfield) - 1] : $field;
                     $data['columns'][] = ucfirst(Shineisp_Registry::getInstance()->Zend_Translate->translate($field));
                 }
             }
         }
     }
     $this->view->columns = $data['columns'];
     if (isset($data['records']) && count($data['records']) > 0) {
         $this->view->fields = array_keys($data['records'][0]);
         $this->view->id = !empty($this->view->fields[0]) && is_numeric($data['records'][0][$this->view->fields[0]]) ? $data['records'][0][$this->view->fields[0]] : "0";
         $this->view->numcols = count($this->view->fields);
         $this->view->records = $data['records'];
         $this->view->currentpage = $data['currentpage'];
         $this->view->pagination = $data['pagination'];
         $this->view->customactions = isset($data['customactions']) ? $data['customactions'] : array();
         $this->view->show_action_box = !isset($data['show_action_box']) ? true : $data['show_action_box'];
     }
     $this->view->recordcount = !empty($data['recordcount']) ? $data['recordcount'] : 0;
     $this->view->statuses = isset($data['statuses']) ? $data['statuses'] : array();
     $this->view->filters = isset($data['filters']) ? $data['filters'] : array();
     $this->view->tags = isset($data['tags']) ? $data['tags'] : array();
     return $this->view->render('partials/grid.phtml');
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:40,代码来源:Grid.php


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