本文整理汇总了PHP中CB\L\get函数的典型用法代码示例。如果您正苦于以下问题:PHP get函数的具体用法?PHP get怎么用?PHP get使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: getName
public function getName($id = false)
{
if ($id === false) {
$id = $this->id;
}
switch ($id) {
case 1:
return L\get('MyCalendar');
}
return 'none';
}
示例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;
}
示例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;
}
示例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';
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}