• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP L\get函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中CB\L\get函数的典型用法代码示例。如果您正苦于以下问题:PHP get函数的具体用法?PHP get怎么用?PHP get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: create

 /**
  * create an object with specified params
  * @param  array $p object properties
  * @return int   created id
  */
 public function create($p = false)
 {
     if ($p !== false) {
         if (array_key_exists('id', $p)) {
             if (is_numeric($p['id'])) {
                 $this->id = $p['id'];
             } else {
                 $this->id = null;
                 unset($p['id']);
             }
         }
         $this->data = $p;
         unset($this->linearData);
         $this->template = null;
         if (!empty($this->data['template_id']) && $this->loadTemplate) {
             $this->template = \CB\Templates\SingletonCollection::getInstance()->getTemplate($this->data['template_id']);
         }
     }
     //check if there is defaultPid specified in template config
     if (!empty($this->template)) {
         $templateData = $this->template->getData();
         if (!empty($templateData['cfg']['defaultPid'])) {
             $this->data['pid'] = $templateData['cfg']['defaultPid'];
         }
     }
     \CB\fireEvent('beforeNodeDbCreate', $this);
     $p =& $this->data;
     if (!Security::canCreateActions($p['pid'])) {
         throw new \Exception(L\get('Access_denied'));
     }
     // check input params
     if (!isset($p['pid'])) {
         throw new \Exception("No pid specified for object creation", 1);
     }
     if (empty($p['name'])) {
         throw new \Exception("No name specified for object creation", 1);
     }
     // we admit object creation without template id
     // if (empty($p['template_id']) || !is_numeric($p['template_id'])) {
     //     throw new \Exception("No template_id specified for object creation", 1);
     // }
     $this->id = DM\Tree::create($this->collectModelData());
     if (!isset($this->id) || !(intval($this->id) > 0)) {
         trigger_error('Error on create object : ' . \CB\Cache::get('lastSql'), E_USER_ERROR);
     }
     $p['id'] = $this->id;
     $this->createCustomData();
     $this->checkDraftChilds();
     //load the object from db to have all its created data
     $this->load();
     //fire create event
     \CB\fireEvent('nodeDbCreate', $this);
     $this->logAction('create', array('mentioned' => $this->lastMentionedUserIds));
     return $this->id;
 }
开发者ID:youprofit,项目名称:casebox,代码行数:60,代码来源:Object.php


示例2: getName

 public function getName($id = false)
 {
     if ($id === false) {
         $id = $this->id;
     }
     switch ($id) {
         case 1:
             return L\get('MyCalendar');
     }
     return 'none';
 }
开发者ID:austinvernsonger,项目名称:casebox,代码行数:11,代码来源:MyCalendar.php


示例3: getName

 public function getName($id = false)
 {
     if ($id == false) {
         $id = $this->id;
     }
     $rez = 'no name';
     switch ($id) {
         case 'users':
             $rez = L\get('Users');
             break;
         default:
             $rez = \CB\User::getDisplayName($id);
     }
     return $rez;
 }
开发者ID:sebbie42,项目名称:casebox,代码行数:15,代码来源:OfficeUsers.php


示例4: create

 /**
  * add a record
  * @param  array $p associative array with table field values
  * @return int   created id
  */
 public static function create($p)
 {
     parent::create($p);
     if (empty($p['name'])) {
         trigger_error(L\get('ErroneousInputData') . ' Empty name for GUID.', E_USER_ERROR);
     }
     //prepare params
     //add database record
     $sql = 'INSERT INTO ' . \CB\PREFIX . '_casebox.guids
             (`name`)
             VALUES ($1)';
     DB\dbQuery($sql, $p['name']) or die(DB\dbQueryError());
     $rez = DB\dbLastInsertId();
     return $rez;
 }
开发者ID:austinvernsonger,项目名称:casebox,代码行数:20,代码来源:GUID.php


示例5: getName

 public function getName($id = false)
 {
     if ($id == false) {
         $id = $this->id;
     }
     switch ($id) {
         case 1:
             return lcfirst(L\get('Overdue'));
         case 2:
             return lcfirst(L\get('Ongoing'));
         case 3:
             return lcfirst(L\get('Closed'));
     }
     return 'none';
 }
开发者ID:austinvernsonger,项目名称:casebox,代码行数:15,代码来源:TaskStatuses.php


示例6: getName

 public function getName($id = false)
 {
     if ($id === false) {
         $id = $this->id;
     }
     $rez = $id;
     switch ($id) {
         case 'recycleBin':
             return L\get('RecycleBin');
         default:
             if (!empty($id) && is_numeric($id)) {
                 $rez = \CB\Objects::getName($id);
             }
             break;
     }
     return $rez;
 }
开发者ID:youprofit,项目名称:casebox,代码行数:17,代码来源:RecycleBin.php


示例7: getName

 public function getName($id = false)
 {
     if ($id == false) {
         $id = $this->id;
     }
     switch ($id) {
         case 1:
             return L\get('Manager');
         case 2:
             return L\get('Lead');
         case 3:
             return L\get('Support');
         case 4:
             return L\get('AllMyCases');
     }
     return Objects::getName($id);
 }
开发者ID:austinvernsonger,项目名称:casebox,代码行数:17,代码来源:CasesGrouped.php


示例8: getName

 public function getName($id = false)
 {
     if ($id === false) {
         $id = $this->id;
     }
     $rez = $id;
     switch ($id) {
         case 'recent':
         case 'commented':
         case 'modified':
         case 'added':
             return L\get(ucfirst($id));
         default:
             $rez = Objects::getName($id);
             break;
     }
     return $rez;
 }
开发者ID:austinvernsonger,项目名称:casebox,代码行数:18,代码来源:RecentActivity.php


示例9: getName

 public function getName($id = false)
 {
     if ($id === false) {
         $id = $this->id;
     }
     $rez = $id;
     switch ($id) {
         case 'favorites':
             return L\get('Favorites');
         default:
             /*if (!empty($id) && is_numeric($id)) {
                   $d = DM\Favorites::read($id);
                   $rez = Util\toJSONArray($d['data'])['name'];
               }/**/
             break;
     }
     return $rez;
 }
开发者ID:sebbie42,项目名称:casebox,代码行数:18,代码来源:Favorites.php


示例10: getName

 public function getName($id = false)
 {
     if ($id === false) {
         $id = $this->id;
     }
     $rez = $id;
     switch (substr($id, 0, 1)) {
         case 'a':
             $rez = L\get('ActionLog');
             break;
         case 'd':
             $rez = Util\formatAgoDate(substr($id, 1, 10));
             break;
         case 'm':
             $rez = L\get('CurrentMonth');
             break;
         case 'g':
             $rez = L\get('Users');
             break;
         case 'q':
             $rez = L\get('Type');
             break;
         case 'u':
             $rez = User::getDisplayName(substr($id, 1));
             break;
         case 't':
             $rez = Util\coalesce(L\get('at' . substr($id, 1)), substr($id, 1));
             break;
         default:
             if (!empty($id) && is_numeric($id)) {
                 $res = DB\dbQuery('SELECT data FROM action_log WHERE id = $1', $id) or die(DB\dbQueryError());
                 if ($r = $res->fetch_assoc()) {
                     $j = Util\toJSONArray($r['data']);
                     $rez = Util\coalesce($j['name'], 'unknown');
                 }
                 $res->close();
             }
             break;
     }
     return $rez;
 }
开发者ID:austinvernsonger,项目名称:casebox,代码行数:41,代码来源:ActionLog.php


示例11: getName

 public function getName($id = false)
 {
     if ($id === false) {
         $id = $this->id;
     }
     $rez = $id;
     switch (substr($id, 0, 1)) {
         case 'a':
             $rez = L\get('ActionLog');
             break;
         case 'd':
             $rez = Util\formatAgoDate(substr($id, 1, 10));
             break;
         case 'm':
             $rez = L\get('CurrentMonth');
             break;
         case 'g':
             $rez = L\get('Users');
             break;
         case 'q':
             $rez = L\get('Type');
             break;
         case 'u':
             $rez = User::getDisplayName(substr($id, 1));
             break;
         case 't':
             $rez = Util\coalesce(L\get('at' . substr($id, 1)), substr($id, 1));
             break;
         default:
             if (!empty($id) && is_numeric($id)) {
                 $r = DM\Log::read($id);
                 if (!empty($r)) {
                     $rez = Util\coalesce($r['data']['name'], 'unknown');
                 }
             }
             break;
     }
     return $rez;
 }
开发者ID:sebbie42,项目名称:casebox,代码行数:39,代码来源:ActionLog.php


示例12: getTitle

 public function getTitle()
 {
     $rez = 'Facet';
     $coreLanguage = \CB\Config::get('language');
     $userLanguage = \CB\Config::get('user_language');
     if (!empty($this->config['title'])) {
         $t =& $this->config['title'];
         if (is_scalar($t)) {
             $rez = $t;
             if ($t[0] == '[') {
                 $rez = L\get(substr($t, 1, strlen($t) - 2));
                 if (empty($rez)) {
                     $rez = $t;
                 }
             }
         } elseif (!empty($t[$userLanguage])) {
             $rez = $t[$userLanguage];
         } elseif (!empty($t[$coreLanguage])) {
             $rez = $t[$coreLanguage];
         }
     }
     return $rez;
 }
开发者ID:youprofit,项目名称:casebox,代码行数:23,代码来源:StringsFacet.php


示例13: getPreviewBlocks

 /**
  * generate html preview for a task
  * @param  int   $id task id
  * @return array
  */
 public function getPreviewBlocks()
 {
     $pb = parent::getPreviewBlocks();
     $data = $this->getData();
     $sd =& $data['sys_data'];
     $template = $this->getTemplate();
     $actionsLine = 'Actions<hr />';
     $dateLines = '';
     $ownerRow = '';
     $assigneeRow = '';
     $contentRow = '';
     //create actions line
     $flags = $this->getActionFlags();
     $actions = array();
     if (!empty($flags['complete'])) {
         $actions[] = '<a action="complete" class="task-action ib-done">' . L\get('Complete') . '</a>';
     }
     if (!empty($flags['close'])) {
         $actions[] = '<a action="close" class="task-action ib-done-all">' . L\get('Close') . '</a>';
     }
     if (!empty($flags['reopen'])) {
         $actions[] = '<a action="reopen" class="task-action ib-repeat">' . L\get('Reopen') . '</a>';
     }
     $actionsLine = '<div class="task-actions">' . implode(' ', $actions) . '</div>';
     //create date and status row
     $ed = $this->getEndDate();
     $status = $this->getStatus();
     if (!empty($ed)) {
         $endDate = Util\formatTaskTime($ed, !$sd['task_allday']);
         // $endDate = empty($sd['task_allday'])
         //     ? Util\formatDateTimePeriod($ed, null, @$_SESSION['user']['cfg']['timezone'])
         //     : Util\formatDatePeriod($ed, null, @$_SESSION['user']['cfg']['timezone']);
         $dateLines = '<tr><td class="prop-key">' . L\get('Due') . ':</td><td>' . $endDate . '</td></tr>';
         // $dateLine .= '<div class="date">' . $endDate . '</div>';
     }
     if (!empty($sd['task_d_closed'])) {
         $dateLines .= '<tr><td class="prop-key">' . L\get('Completed') . ':</td><td>' . Util\formatAgoTime($sd['task_d_closed']) . '</td></tr>';
     }
     //create owner row
     $v = $this->getOwner();
     if (!empty($v)) {
         $cn = User::getDisplayName($v);
         $cdt = Util\formatAgoTime($data['cdate']);
         $cd = Util\formatDateTimePeriod($data['cdate'], null, @$_SESSION['user']['cfg']['timezone']);
         $ownerRow = '<tr><td class="prop-key">' . L\get('Owner') . ':</td><td>' . '<table class="prop-val people"><tbody>' . '<tr><td class="user"><img class="photo32" src="photo/' . $v . '.jpg?32=' . User::getPhotoParam($v) . '" style="width:32px; height: 32px" alt="' . $cn . '" title="' . $cn . '"></td>' . '<td><b>' . $cn . '</b><p class="gr">' . L\get('Created') . ': ' . '<span class="dttm" title="' . $cd . '">' . $cdt . '</span></p></td></tr></tbody></table>' . '</td></tr>';
     }
     //create assignee row
     $v = $this->getFieldValue('assigned', 0);
     if (!empty($v['value'])) {
         $isOwner = $this->isOwner();
         $assigneeRow .= '<tr><td class="prop-key">' . L\get('TaskAssigned') . ':</td><td><table class="prop-val people"><tbody>';
         $v = Util\toNumericArray($v['value']);
         $dateFormat = \CB\getOption('long_date_format') . ' H:i:s';
         foreach ($v as $id) {
             $un = User::getDisplayName($id);
             $completed = $this->getUserStatus($id) == static::$USERSTATUS_DONE;
             $flags = $this->getActionFlags($id);
             $cdt = '';
             //completed date title
             $dateText = '';
             if ($completed && !empty($sd['task_u_d_closed'][$id])) {
                 $cdt = Util\formatMysqlDate($sd['task_u_d_closed'][$id], $dateFormat);
                 $dateText = ': ' . Util\formatAgoTime($sd['task_u_d_closed'][$id]);
             }
             $assigneeRow .= '<tr><td class="user"><div style="position: relative">' . '<img class="photo32" src="photo/' . $id . '.jpg?32=' . User::getPhotoParam($id) . '" style="width:32px; height: 32px" alt="' . $un . '" title="' . $un . '">' . ($completed ? '<img class="done icon icon-tick-circle" src="/css/i/s.gif" />' : "") . '</div></td><td><b>' . $un . '</b>' . '<p class="gr" title="' . $cdt . '">' . ($completed ? L\get('Completed') . $dateText . ($isOwner ? ' <a class="bt task-action click" action="markincomplete" uid="' . $id . '">' . L\get('revoke') . '</a>' : '') : L\get('waitingForAction') . ($isOwner ? ' <a class="bt task-action click" action="markcomplete" uid="' . $id . '">' . L\get('complete') . '</a>' : '')) . '</p></td></tr>';
         }
         $assigneeRow .= '</tbody></table></td></tr>';
     }
     //create description row
     $v = $this->getFieldValue('description', 0);
     if (!empty($v['value'])) {
         $tf = $template->getField('description');
         $v = $template->formatValueForDisplay($tf, $v);
         $contentRow = '<tr><td class="prop-val" colspan="2">' . $v . '</td></tr>';
     }
     //insert rows
     $p = $pb[0];
     $pos = strrpos($p, '<tbody>');
     $p = substr($p, $pos + 7);
     $pos = strrpos($p, '</tbody>');
     if ($pos !== false) {
         $p = substr($p, 0, $pos);
     }
     $pb[0] = $actionsLine . '<table class="obj-preview"><tbody>' . $dateLines . $p . $ownerRow . $assigneeRow . $contentRow . '<tbody></table>';
     return $pb;
 }
开发者ID:youprofit,项目名称:casebox,代码行数:91,代码来源:Task.php


示例14: changeStatus

 /**
  * change status for a task
  * @param  int  $status
  * @param  int  $id
  * @return json response
  */
 protected function changeStatus($id, $status)
 {
     $obj = Objects::getCachedObject($id);
     $data = $obj->getData();
     //status change for task is allowed only for owner or admin
     if (!$obj->isOwner() && !Security::isAdmin()) {
         return array('success' => false, 'msg' => L\get('No_access_for_this_action'));
     }
     switch ($status) {
         case Objects\Task::$STATUS_ACTIVE:
             $obj->setActive();
             break;
         case Objects\Task::$STATUS_CLOSED:
             $obj->setClosed();
             break;
         default:
             return array('success' => false, 'id' => $id);
     }
     $this->afterUpdate($id);
     return array('success' => true, 'id' => $id);
 }
开发者ID:sebbie42,项目名称:casebox,代码行数:27,代码来源:Tasks.php


示例15: getDepthChildren3

 protected function getDepthChildren3()
 {
     $userId = User::getId();
     $p = $this->requestParams;
     $p['fq'] = $this->fq;
     if ($this->lastNode->id == 2) {
         $p['fq'][] = 'task_u_ongoing:' . $userId;
     } else {
         $p['fq'][] = 'cid:' . $userId;
     }
     $rez = array();
     if (@$this->requestParams['from'] == 'tree') {
         $s = new \CB\Search();
         $sr = $s->query(array('rows' => 0, 'fq' => $p['fq'], 'facet' => true, 'facet.field' => array('{!ex=task_status key=0task_status}task_status')));
         $rez = array('data' => array());
         if (!empty($sr['facets']->facet_fields->{'0task_status'}->{'1'})) {
             $rez['data'][] = array('name' => lcfirst(L\get('Overdue')) . $this->renderCount($sr['facets']->facet_fields->{'0task_status'}->{'1'}), 'id' => $this->getId(4), 'iconCls' => 'icon-task');
         }
         if (!empty($sr['facets']->facet_fields->{'0task_status'}->{'2'})) {
             $rez['data'][] = array('name' => lcfirst(L\get('Ongoing')) . $this->renderCount($sr['facets']->facet_fields->{'0task_status'}->{'2'}), 'id' => $this->getId(5), 'iconCls' => 'icon-task');
         }
         if (!empty($sr['facets']->facet_fields->{'0task_status'}->{'3'})) {
             $rez['data'][] = array('name' => lcfirst(L\get('Closed')) . $this->renderCount($sr['facets']->facet_fields->{'0task_status'}->{'3'}), 'id' => $this->getId(6), 'iconCls' => 'icon-task');
         }
         // Add assignee node if there are any created tasks already added to result
         if ($this->lastNode->id == 3 && !empty($rez['data'])) {
             $rez['data'][] = array('name' => lcfirst(L\get('Assignee')), 'id' => $this->getId('assignee'), 'iconCls' => 'icon-task', 'has_childs' => true);
         }
     } else {
         $p['fq'][] = 'task_status:(1 OR 2)';
         $s = new \CB\Search();
         $rez = $s->query($p);
         foreach ($rez['data'] as &$n) {
             $n['has_childs'] = true;
         }
     }
     return $rez;
 }
开发者ID:sebbie42,项目名称:casebox,代码行数:38,代码来源:Tasks.php


示例16: getName

 public function getName($id = false)
 {
     if ($id == false) {
         $id = $this->id;
     }
     $rez = 'no name';
     if ($id == 'cases') {
         return L\get('Cases');
     }
     $res = DB\dbQuery('SELECT name FROM tree WHERE id = $1', $id) or die(DB\dbQueryError());
     if ($r = $res->fetch_assoc()) {
         $rez = $r['name'];
     }
     $res->close();
     return $rez;
 }
开发者ID:youprofit,项目名称:casebox,代码行数:16,代码来源:OfficeCases.php


示例17: validateParamTypes

 /**
  * validate param types
  * @param  array $p
  * @param  array $fields - default is $tableFields
  * @return void  |  throws an exception on error
  */
 protected static function validateParamTypes($p, $fields = false)
 {
     if ($fields === false) {
         $fields = static::$tableFields;
     }
     foreach ($fields as $fn => $ft) {
         $valid = true;
         if (!isset($p[$fn]) || is_null($p[$fn])) {
             continue;
         }
         switch ($ft) {
             case 'int':
             case 'float':
                 $valid = is_numeric($p[$fn]);
                 break;
             case 'bool':
                 $valid = is_bool($p[$fn]);
                 break;
             case 'char':
                 $valid = is_string($p[$fn]) && mb_strlen($p[$fn]) < 2;
                 break;
             case 'enum':
             case 'varchar':
             case 'text':
                 $valid = is_string($p[$fn]);
                 break;
             case 'time':
             case 'timestamp':
             case 'date':
                 $dt = explode(' ', $p[$fn]);
                 $valid = sizeof($dt) < 3;
                 if ($valid) {
                     $d = explode('-', $dt[0]);
                     $valid = sizeof($dt) == 3;
                     if ($valid) {
                         $valid = is_numeric($d[0]) && is_numeric($d[1]) && is_numeric($d[2]);
                     }
                 }
                 if ($valid && !empty($dt[1])) {
                     $t = explode(':', $dt[1]);
                     $valid = sizeof($dt) < 4;
                     if ($valid) {
                         $valid = is_numeric($t[0]) && is_numeric($t[1]) && (empty($t[2]) || is_numeric($t[2]));
                     }
                 }
                 break;
         }
         if (!$valid) {
             trigger_error(L\get('ErroneousInputData') . ' Invalid value for field "' . $fn . '"', E_USER_ERROR);
         }
     }
 }
开发者ID:austinvernsonger,项目名称:casebox,代码行数:58,代码来源:Base.php


示例18: getClientData

 public function getClientData()
 {
     $rez = array('f' => $this->field, 'title' => $this->getTitle(), 'items' => array());
     $cfg =& $this->config;
     if (!empty($cfg['manualPeriod'])) {
         $rez['manualPeriod'] = true;
     }
     foreach ($cfg['queries'] as $key => $query) {
         $qk = $cfg['name'] . '_' . $key;
         if (!empty($this->solrData[$query])) {
             $name = L\get($query);
             if (empty($name)) {
                 $name = $query;
             }
             $rez['items'][$query] = array('name' => $name, 'count' => $this->solrData[$query]);
         }
     }
     return $rez;
 }
开发者ID:austinvernsonger,项目名称:casebox,代码行数:19,代码来源:DatesFacet.php


示例19: create

 /**
  * create an object with specified params
  * @param  array $p object properties
  * @return int   created id
  */
 public function create($p = false)
 {
     if ($p !== false) {
         if (array_key_exists('id', $p)) {
             if (is_numeric($p['id'])) {
                 $this->id = $p['id'];
             } else {
                 $this->id = null;
                 unset($p['id']);
             }
         }
         $this->data = $p;
         unset($this->linearData);
         $this->template = null;
         if (!empty($this->data['template_id']) && $this->loadTemplate) {
             $this->template = \CB\Templates\SingletonCollection::getInstance()->getTemplate($this->data['template_id']);
         }
     }
     //check if there is defaultPid specified in template config
     if (!empty($this->template)) {
         $templateData = $this->template->getData();
         if (!empty($templateData['cfg']['defaultPid'])) {
             $this->data['pid'] = $templateData['cfg']['defaultPid'];
         }
     }
     \CB\fireEvent('beforeNodeDbCreate', $this);
     $p =& $this->data;
     if (!Security::canCreateActions($p['pid'])) {
         throw new \Exception(L\get('Access_denied'));
     }
     // check input params
     if (!isset($p['pid'])) {
         throw new \Exception("No pid specified for object creation", 1);
     }
     if (empty($p['name'])) {
         throw new \Exception("No name specified for object creation", 1);
     }
     // we admit object creation without template id
     // if (empty($p['template_id']) || !is_numeric($p['template_id'])) {
     //     throw new \Exception("No template_id specified for object creation", 1);
     // }
     if (empty($p['pid'])) {
         $p['pid'] = null;
     }
     $draftPid = empty($p['draftPid']) ? null : $p['draftPid'];
     $isDraft = intval(!empty($draftPid) || !empty($p['draft']));
     if (empty($p['date_end'])) {
         $p['date_end'] = null;
     }
     if (empty($p['tag_id'])) {
         $p['tag_id'] = null;
     }
     if (empty($p['cid'])) {
         $p['cid'] = $_SESSION['user']['id'];
     }
     if (empty($p['oid'])) {
         $p['oid'] = $p['cid'];
     }
     if (empty($p['cdate'])) {
         $p['cdate'] = null;
     }
     DB\dbQuery('INSERT INTO tree (
             id
             ,pid
             ,draft
             ,draft_pid
             ,template_id
             ,tag_id
             ,target_id
             ,name
             ,date
             ,date_end
             ,size
             ,cfg
             ,cid
             ,oid
             ,cdate
             ,`system`
             ,updated
         )
         VALUES (
             $1
             ,$2
             ,$3
             ,$4
             ,$5
             ,$6
             ,$7
             ,$8
             ,$9
             ,$10
             ,$11
             ,$12
             ,$13
             ,$14
//.........这里部分代码省略.........
开发者ID:ameliefranco,项目名称:casebox,代码行数:101,代码来源:Object.php


示例20: formatValueForDisplay

 /**
  * formats a value for display according to it's field definition
  * @param  array | int $field array of field properties or field id
  * @param  variant     $value field value to be formated
  * @param  boolean     $html  default true - format for html, otherwise format for text display
  * @return varchar     formated value
  */
 public static function formatValueForDisplay($field, $value, $html = true)
 {
     $cacheVarName = '';
     if (is_numeric($field)) {
         $field = $this->data->fields[$field];
     }
     //condition is specified for values from search templates
     $condition = null;
     if (is_array($value)) {
         if (isset($value['cond'])) {
             $condition = Template::formatConditionForDisplay($field, $value['cond'], $html) . ' ';
         }
         if (isset($value['value'])) {
             $value = $value['value'];
         } else {
             $value = null;
         }
     }
     //we'll cache scalar by default, but will exclude textual fields
     $cacheValue = is_scalar($value);
     if ($cacheValue) {
         $fid = empty($field['id']) ? $field['name'] : $field['id'];
         $cacheVarName = 'dv' . $html . '_' . $fid . '_' . $value;
         //check if value is in cache and return
         if (Cache::exist($cacheVarName)) {
             return Cache::get($cacheVarName);
         }
     }
     /*check if field is not rezerved field for usernames (cid, oid, uid, did)*/
     if (!empty($field['name']) && in_array($field['name'], array('cid', 'oid', 'uid', 'did'))) {
         $value = Util\toNumericArray($value);
         for ($i = 0; $i < sizeof($value); $i++) {
             $value[$i] = User::getDisplayName($value[$i]);
         }
         $value = implode(', ', $value);
     } else {
         switch ($field['type']) {
             case 'boolean':
             case 'checkbox':
                 $value = empty($value) ? '' : ($value < 0 ? L\get('no') : L\get('yes'));
                 break;
             case '_sex':
                 switch ($value) {
                     case 'm':
                         $value = L\get('male');
                         break;
                     case 'f':
                         $value = L\get('female');
                         break;
                     default:
                         $value = '';
                 }
                 break;
             case '_language':
                 @($value = @\CB\Config::get('language_settings')[\CB\Config::get('languages')[$value - 1]][0]);
                 break;
             case 'combo':
             case '_objects':
                 if (empty($value)) {
                     $value = '';
                     break;
                 }
                 $ids = Util\toNumericArray($value);
                 if (empty($ids)) {
                     if (empty($field['cfg']['source']) || !is_array($field['cfg']['source'])) {
                         $value = '';
                     }
                     break;
                 }
                 $value = array();
                 if (in_array(@$field['cfg']['source'], array('users', 'groups', 'usersgroups'))) {
                     $udp = UsersGroups::getDisplayData($ids);
                     foreach ($ids as $id) {
                         if (empty($udp[$id])) {
                             continue;
                         }
                         $r =& $udp[$id];
                         $label = @htmlspecialchars(Util\coalesce($r['title'], $r['name']), ENT_COMPAT);
                         if ($html) {
                             switch (@$field['cfg']['renderer']) {
                                 case 'listGreenIcons':
                                     $label = '<li class="icon-padding icon-element">' . $label . '</li>';
                                     break;
                                     // case 'listObjIcons':
                                 // case 'listObjIcons':
                                 default:
                                     $icon = empty($r['iconCls']) ? 'icon-none' : $r['iconCls'];
                                     $label = '<li class="icon-padding ' . $icon . '">' . $label . '</li>';
                                     break;
                             }
                         }
                         $value[] = $label;
                     }
//.........这里部分代码省略.........
开发者ID:sebbie42,项目名称:casebox,代码行数:101,代码来源:Template.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Util\toNumericArray函数代码示例发布时间:2022-05-23
下一篇:
PHP DB\dbQueryError函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap