本文整理汇总了PHP中app::getArrayName方法的典型用法代码示例。如果您正苦于以下问题:PHP app::getArrayName方法的具体用法?PHP app::getArrayName怎么用?PHP app::getArrayName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app
的用法示例。
在下文中一共展示了app::getArrayName方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeGoto
public function executeGoto(sfWebRequest $request)
{
$q = Doctrine_Core::getTable('Discussions')->createQuery('d')->leftJoin('d.DiscussionsStatus ds')->leftJoin('d.Projects p')->leftJoin('d.Users');
$q->addWhere('projects_id=?', $request->getParameter('projects_id'));
if (Users::hasAccess('view_own', 'discussions', $this->getUser(), $request->getParameter('projects_id'))) {
$q->addWhere("find_in_set('" . $this->getUser()->getAttribute('id') . "',d.assigned_to) or d.users_id='" . $this->getUser()->getAttribute('id') . "'");
}
$q = Discussions::addFiltersToQuery($q, $this->getUser()->getAttribute('discussions_filter' . ((int) $request->getParameter('projects_id') > 0 ? $request->getParameter('projects_id') : '')));
$q = app::addListingOrder($q, 'discussions', $this->getUser(), (int) $request->getParameter('projects_id'));
$this->menu = array();
$ids = array();
foreach ($q->fetchArray() as $v) {
if (strlen($sn = app::getArrayName($v, 'DiscussionsStatus')) > 0) {
$sn = $sn . ': ';
} else {
$sn = '';
}
if ($request->getParameter('discussions_id') == $v['id']) {
$v['name'] = '<b>' . $v['name'] . '</b>';
}
$this->menu[] = array('title' => $sn . $v['name'], 'url' => 'discussionsComments/index?projects_id=' . $request->getParameter('projects_id') . '&discussions_id=' . $v['id']);
$ids[] = $v['id'];
}
$current_key = array_search($request->getParameter('discussions_id'), $ids);
$this->previous_item_id = false;
$this->next_item_id = false;
if (isset($ids[$current_key - 1])) {
$this->previous_item_id = $ids[$current_key - 1];
}
if (isset($ids[$current_key + 1])) {
$this->next_item_id = $ids[$current_key + 1];
}
}
示例2: executeGoto
public function executeGoto(sfWebRequest $request)
{
$q = Doctrine_Core::getTable('Tickets')->createQuery('t')->leftJoin('t.TicketsStatus ts')->leftJoin('t.TicketsTypes tt')->leftJoin('t.Departments td')->leftJoin('t.Projects p')->leftJoin('t.Users');
$q->addWhere('projects_id=?', $request->getParameter('projects_id'));
if (Users::hasAccess('view_own', 'tickets', $this->getUser(), $request->getParameter('projects_id'))) {
$q->addWhere("t.departments_id in (" . implode(',', Departments::getDepartmentIdByUserId($this->getUser()->getAttribute('id'))) . ") or t.users_id='" . $this->getUser()->getAttribute('id') . "'");
}
$q = Tickets::addFiltersToQuery($q, $this->getUser()->getAttribute('tickets_filter' . ((int) $request->getParameter('projects_id') > 0 ? $request->getParameter('projects_id') : '')));
$q = app::addListingOrder($q, 'tickets', $this->getUser(), (int) $request->getParameter('projects_id'));
$this->menu = array();
$ids = array();
foreach ($q->fetchArray() as $v) {
if (strlen($sn = app::getArrayName($v, 'TicketsStatus')) > 0) {
$sn = $sn . ': ';
} else {
$sn = '';
}
if ($request->getParameter('tickets_id') == $v['id']) {
$v['name'] = '<b>' . $v['name'] . '</b>';
}
$this->menu[] = array('title' => $sn . $v['name'], 'url' => 'ticketsComments/index?projects_id=' . $request->getParameter('projects_id') . '&tickets_id=' . $v['id']);
$ids[] = $v['id'];
}
$current_key = array_search($request->getParameter('tickets_id'), $ids);
$this->previous_item_id = false;
$this->next_item_id = false;
if (isset($ids[$current_key - 1])) {
$this->previous_item_id = $ids[$current_key - 1];
}
if (isset($ids[$current_key + 1])) {
$this->next_item_id = $ids[$current_key + 1];
}
}
示例3: executeGoto
public function executeGoto(sfWebRequest $request)
{
$q = Doctrine_Core::getTable('Tasks')->createQuery('t')->leftJoin('t.TasksPriority tp')->leftJoin('t.TasksStatus ts')->leftJoin('t.TasksLabels tl')->leftJoin('t.TasksTypes tt')->leftJoin('t.TasksGroups tg')->leftJoin('t.ProjectsPhases pp')->leftJoin('t.Versions v')->leftJoin('t.Projects p')->leftJoin('t.Users');
$q->addWhere('projects_id=?', $request->getParameter('projects_id'));
if (Users::hasAccess('view_own', 'tasks', $this->getUser(), $request->getParameter('projects_id'))) {
$q->addWhere("find_in_set('" . $this->getUser()->getAttribute('id') . "',t.assigned_to) or t.created_by='" . $this->getUser()->getAttribute('id') . "'");
}
$q = Tasks::addFiltersToQuery($q, $this->getUser()->getAttribute('tasks_filter' . ((int) $request->getParameter('projects_id') > 0 ? $request->getParameter('projects_id') : '')));
$q = app::addListingOrder($q, 'tasks', $this->getUser(), (int) $request->getParameter('projects_id'));
$this->menu = array();
$tasks_ids = array();
foreach ($q->fetchArray() as $tasks) {
if (strlen($sn = app::getArrayName($tasks, 'TasksStatus')) > 0) {
$sn = $sn . ': ';
} else {
$sn = '';
}
if ($request->getParameter('tasks_id') == $tasks['id']) {
$tasks['name'] = '<b>' . $tasks['name'] . '</b>';
}
$this->menu[] = array('title' => $sn . $tasks['name'], 'url' => 'tasksComments/index?projects_id=' . $request->getParameter('projects_id') . '&tasks_id=' . $tasks['id']);
$tasks_ids[] = $tasks['id'];
}
$current_key = array_search($request->getParameter('tasks_id'), $tasks_ids);
$this->previous_tasks_id = false;
$this->next_tasks_id = false;
if (isset($tasks_ids[$current_key - 1])) {
$this->previous_tasks_id = $tasks_ids[$current_key - 1];
}
if (isset($tasks_ids[$current_key + 1])) {
$this->next_tasks_id = $tasks_ids[$current_key + 1];
}
}
示例4: array
</td>
<?php
}
?>
<?php
$v = ExtraFieldsList::getValuesList($extra_fields, $tasks['id']);
echo ExtraFieldsList::renderListingTbody($extra_fields, $v, array('est_time' => $tasks['estimated_time']));
$totals = ExtraFieldsList::getListingTotals($totals, $extra_fields, $v, array('est_time' => $tasks['estimated_time']));
?>
<?php
if (!$sf_request->hasParameter('projects_id')) {
?>
<td><?php
echo link_to(app::getArrayName($tasks, 'Projects'), 'projectsComments/index?projects_id=' . $tasks['projects_id']);
?>
</td>
<?php
}
?>
</tr>
<?php
}
?>
</tbody>
<?php
if (count($tasks_list) > 0 and count($totals) > 0) {
?>
<tfoot>
示例5: executeExport
public function executeExport(sfWebRequest $request)
{
$this->columns = array('id' => t::__('Id'), 'UsersGroups' => t::__('Group'), 'name' => t::__('Name'), 'email' => t::__('Email'));
$extra_fields = ExtraFieldsList::getFieldsByType('users', $this->getUser(), false, array('all' => true));
foreach ($extra_fields as $v) {
$this->columns['extra_field_' . $v['id']] = $v['name'];
}
if ($fields = $request->getParameter('fields')) {
$separator = "\t";
$format = $request->getParameter('format', '.csv');
$filename = $request->getParameter('filename', 'users');
header("Content-type: Application/octet-stream");
header("Content-disposition: attachment; filename=" . $filename . "." . $format);
header("Pragma: no-cache");
header("Expires: 0");
$content = '';
foreach ($fields as $f) {
$content .= str_replace(array("\n\r", "\r", "\n", $separator), ' ', $this->columns[$f]) . $separator;
}
$content .= "\n";
if ($format == 'csv') {
echo chr(0xff) . chr(0xfe) . mb_convert_encoding($content, 'UTF-16LE', 'UTF-8');
} else {
echo $content;
}
if (strlen($request->getParameter('selected_items') == 0)) {
exit;
}
$q = Doctrine_Core::getTable('Users')->createQuery('u')->leftJoin('u.UsersGroups ug')->whereIn('u.id', explode(',', $request->getParameter('selected_items')));
$users = $q->orderBy('ug.name, u.name')->fetchArray();
foreach ($users as $u) {
$ex_values = ExtraFieldsList::getValuesList($extra_fields, $u['id']);
$content = '';
foreach ($fields as $f) {
$v = '';
if (in_array($f, array('id', 'name', 'email'))) {
$v = $u[$f];
} elseif (strstr($f, 'extra_field_')) {
if ($ex = Doctrine_Core::getTable('ExtraFields')->find(str_replace('extra_field_', '', $f))) {
$v = ExtraFieldsList::renderFieldValueByType($ex, $ex_values, array(), true);
$v = str_replace('<br>', ', ', $v);
}
} else {
$v = app::getArrayName($u, $f);
}
$content .= str_replace(array("\n\r", "\r", "\n", $separator), ' ', $v) . $separator;
}
$content .= "\n";
if ($format == 'csv') {
echo chr(0xff) . chr(0xfe) . mb_convert_encoding($content, 'UTF-16LE', 'UTF-8');
} else {
echo $content;
}
}
exit;
}
}
示例6: link_to
echo app::getArrayNameWithBg($tickets, 'TicketsTypes');
?>
</td>
<?php
}
?>
<td>
<?php
echo link_to($tickets['name'], 'ticketsComments/index?tickets_id=' . $tickets['id'] . ($tickets['projects_id'] > 0 ? '&projects_id=' . $tickets['projects_id'] : ''));
?>
</td>
<td><?php
echo app::getArrayName($tickets, 'Departments');
?>
</td>
<td><?php
if (strlen($tickets['user_name']) > 0) {
echo $tickets['user_name'];
} else {
echo $tickets['Users']['name'];
}
?>
</td>
</tr>
<?php
}
?>
示例7: executeExport
//.........这里部分代码省略.........
$q = app::addListingOrder($q, 'tickets', $this->getUser(), (int) $request->getParameter('projects_id'));
} else {
$q->orderBy('LTRIM(p.name), ts.sort_order, LTRIM(ts.name), LTRIM(t.name)');
}
$tickets = $q->fetchArray();
$totals = array();
$projects_totals = array();
$current_project_id = 0;
foreach ($tickets as $t) {
$ex_values = ExtraFieldsList::getValuesList($extra_fields, $t['id']);
$content = '';
//
if ($current_project_id == 0) {
$current_project_id = $t['projects_id'];
}
if ($current_project_id != $t['projects_id']) {
//adding totals
if (isset($projects_totals[$current_project_id])) {
foreach ($fields as $f) {
$v = '';
if (strstr($f, 'extra_field_')) {
if (isset($projects_totals[$current_project_id][str_replace('extra_field_', '', $f)])) {
$v = $projects_totals[$current_project_id][str_replace('extra_field_', '', $f)];
}
}
$content .= str_replace(array("\n\r", "\r", "\n", $separator), ' ', $v) . $separator;
}
$content .= "\n\n";
}
$current_project_id = $t['projects_id'];
}
foreach ($fields as $f) {
$v = '';
if (in_array($f, array('id', 'name', 'description'))) {
$v = $t[$f];
} elseif (strstr($f, 'extra_field_')) {
if ($ex = Doctrine_Core::getTable('ExtraFields')->find(str_replace('extra_field_', '', $f))) {
$v = ExtraFieldsList::renderFieldValueByType($ex, $ex_values, array(), true);
if (in_array($ex->getType(), array('number', 'formula'))) {
if (!isset($totals[$ex->getId()])) {
$totals[$ex->getId()] = 0;
}
if (!isset($projects_totals[$t['projects_id']][$ex->getId()])) {
$projects_totals[$t['projects_id']][$ex->getId()] = 0;
}
$totals[$ex->getId()] += $v;
$projects_totals[$t['projects_id']][$ex->getId()] += $v;
}
$v = str_replace('<br>', ', ', $v);
}
} elseif ($f == 'created_at') {
if (strlen($t[$f]) > 0) {
$v = app::dateTimeFormat($t[$f]);
}
} elseif ($f == 'url') {
$v = app::public_url('ticketsComments/index?projects_id=' . $t['projects_id'] . '&tickets_id=' . $t['id']);
} else {
$v = app::getArrayName($t, $f);
}
$content .= str_replace(array("\n\r", "\r", "\n", $separator), ' ', $v) . $separator;
}
$content .= "\n";
if ($format == 'csv') {
echo chr(0xff) . chr(0xfe) . mb_convert_encoding($content, 'UTF-16LE', 'UTF-8');
} else {
echo $content;
}
}
$content = '';
//adding totals
if (isset($projects_totals[$current_project_id]) and !$request->hasParameter('projects_id')) {
foreach ($fields as $f) {
$v = '';
if (strstr($f, 'extra_field_')) {
if (isset($projects_totals[$current_project_id][str_replace('extra_field_', '', $f)])) {
$v = $projects_totals[$current_project_id][str_replace('extra_field_', '', $f)];
}
}
$content .= str_replace(array("\n\r", "\r", "\n", $separator), ' ', $v) . $separator;
}
$content .= "\n\n";
}
foreach ($fields as $f) {
$v = '';
if (strstr($f, 'extra_field_')) {
if (isset($totals[str_replace('extra_field_', '', $f)])) {
$v = $totals[str_replace('extra_field_', '', $f)];
}
}
$content .= str_replace(array("\n\r", "\r", "\n", $separator), ' ', $v) . $separator;
}
$content .= "\n";
if ($format == 'csv') {
echo chr(0xff) . chr(0xfe) . mb_convert_encoding($content, 'UTF-16LE', 'UTF-8');
} else {
echo $content;
}
exit;
}
}
示例8:
?>
</td>
<?php
if ($is_filter['type']) {
?>
<td><?php
echo app::getArrayName($projects, 'ProjectsTypes');
?>
</td>
<?php
}
?>
<td><?php
echo app::getArrayName($projects, 'Users');
?>
</td>
<td><?php
echo app::dateTimeFormat($projects['created_at'], 0, true);
?>
</td>
<?php
$v = ExtraFieldsList::getValuesList($extra_fields, $projects['id']);
echo ExtraFieldsList::renderListingTbody($extra_fields, $v);
$totals = ExtraFieldsList::getListingTotals($totals, $extra_fields, $v);
?>
</tr>
<?php
}
示例9: executeExport
public function executeExport(sfWebRequest $request)
{
/*check access*/
Users::checkAccess($this, 'view', $this->getModuleName(), $this->getUser());
$this->columns = array('id' => t::__('Id'), 'ProjectsStatus' => t::__('Status'), 'name' => t::__('Name'), 'description' => t::__('Description'), 'team' => t::__('Team'), 'ProjectsTypes' => t::__('Type'), 'Users' => t::__('Created By'), 'created_at' => t::__('Created At'));
$extra_fields = ExtraFieldsList::getFieldsByType('projects', $this->getUser(), false, array('all' => true));
foreach ($extra_fields as $v) {
$this->columns['extra_field_' . $v['id']] = $v['name'];
}
$this->columns['url'] = t::__('Url');
if ($fields = $request->getParameter('fields')) {
$separator = "\t";
$format = $request->getParameter('format', '.csv');
$filename = $request->getParameter('filename', 'projects');
header("Content-type: Application/octet-stream");
header("Content-disposition: attachment; filename=" . $filename . "." . $format);
header("Pragma: no-cache");
header("Expires: 0");
$content = '';
foreach ($fields as $f) {
$content .= str_replace(array("\n\r", "\r", "\n", $separator), ' ', $this->columns[$f]) . $separator;
}
$content .= "\n";
if ($format == 'csv') {
echo chr(0xff) . chr(0xfe) . mb_convert_encoding($content, 'UTF-16LE', 'UTF-8');
} else {
echo $content;
}
if (strlen($request->getParameter('selected_items') == 0)) {
exit;
}
$q = Doctrine_Core::getTable('Projects')->createQuery('p')->leftJoin('p.ProjectsStatus ps')->leftJoin('p.ProjectsTypes pt')->leftJoin('p.Users')->whereIn('p.id', explode(',', $request->getParameter('selected_items')));
if (Users::hasAccess('view_own', 'projects', $this->getUser())) {
$q->addWhere("find_in_set('" . $this->getUser()->getAttribute('id') . "',p.team) or p.created_by='" . $this->getUser()->getAttribute('id') . "'");
}
$q = app::addListingOrder($q, 'projects', $this->getUser());
$projects = $q->fetchArray();
$totals = array();
foreach ($projects as $p) {
$ex_values = ExtraFieldsList::getValuesList($extra_fields, $p['id']);
$content = '';
foreach ($fields as $f) {
$v = '';
if (in_array($f, array('id', 'name', 'description'))) {
$v = $p[$f];
} elseif (strstr($f, 'extra_field_')) {
if ($ex = Doctrine_Core::getTable('ExtraFields')->find(str_replace('extra_field_', '', $f))) {
$v = ExtraFieldsList::renderFieldValueByType($ex, $ex_values, array(), true);
if (in_array($ex->getType(), array('number', 'formula'))) {
if (!isset($totals[$ex->getId()])) {
$totals[$ex->getId()] = 0;
}
$totals[$ex->getId()] += $v;
}
$v = str_replace('<br>', ', ', $v);
}
} elseif ($f == 'team') {
$v = Users::getNameById($p[$f], ', ');
} elseif ($f == 'created_at') {
if (strlen($p[$f]) > 0) {
$v = date(app::getDateTimeFormat(), app::getDateTimestamp($p[$f]));
}
} elseif ($f == 'url') {
$v = app::public_url('projectsComments/index?projects_id=' . $p['id']);
} else {
$v = app::getArrayName($p, $f);
}
$content .= str_replace(array("\n\r", "\r", "\n", $separator), ' ', $v) . $separator;
}
$content .= "\n";
if ($format == 'csv') {
echo chr(0xff) . chr(0xfe) . mb_convert_encoding($content, 'UTF-16LE', 'UTF-8');
} else {
echo $content;
}
}
$content = '';
foreach ($fields as $f) {
$v = '';
if (strstr($f, 'extra_field_')) {
if (isset($totals[str_replace('extra_field_', '', $f)])) {
$v = $totals[str_replace('extra_field_', '', $f)];
}
}
$content .= str_replace(array("\n\r", "\r", "\n", $separator), ' ', $v) . $separator;
}
$content .= "\n";
if ($format == 'csv') {
echo chr(0xff) . chr(0xfe) . mb_convert_encoding($content, 'UTF-16LE', 'UTF-8');
} else {
echo $content;
}
exit;
}
}
示例10: executeExport
//.........这里部分代码省略.........
if ($f == 'name') {
$v = $name_adding . $t[$f];
} elseif (in_array($f, array('id', 'description', 'estimated_time', 'work_hours'))) {
if ($f == 'work_hours') {
$v = TasksComments::getTotalWorkHours($t['id']);
} else {
$v = $t[$f];
}
if (in_array($f, array('estimated_time', 'work_hours'))) {
if (!isset($totals[$f])) {
$totals[$f] = 0;
}
if (!isset($projects_totals[$t['projects_id']][$f])) {
$projects_totals[$t['projects_id']][$f] = 0;
}
$totals[$f] += $v;
$projects_totals[$t['projects_id']][$f] += $v;
}
} elseif (in_array($f, array('start_date', 'due_date', 'created_at'))) {
$v = app::dateTimeFormat($t[$f]);
} elseif ($f == 'progress') {
$v = (int) $t['progress'] . '%';
} elseif (strstr($f, 'extra_field_')) {
if ($ex = Doctrine_Core::getTable('ExtraFields')->find(str_replace('extra_field_', '', $f))) {
$v = ExtraFieldsList::renderFieldValueByType($ex, $ex_values, array(), true);
if (in_array($ex->getType(), array('number', 'formula'))) {
if (!isset($totals[$ex->getId()])) {
$totals[$ex->getId()] = 0;
}
if (!isset($projects_totals[$t['projects_id']][$ex->getId()])) {
$projects_totals[$t['projects_id']][$ex->getId()] = 0;
}
$totals[$ex->getId()] += $v;
$projects_totals[$t['projects_id']][$ex->getId()] += $v;
}
$v = str_replace('<br>', ', ', $v);
}
} elseif ($f == 'assigned_to') {
$v = Users::getNameById($t[$f], ', ');
} elseif ($f == 'url') {
$v = app::public_url('tasksComments/index?projects_id=' . $t['projects_id'] . '&tasks_id=' . $t['id']);
} elseif ($f == 'actual_time') {
if ($t['work_hours'] > 0 and $t['togo_hours'] == 0) {
$v = $t['work_hours'];
} else {
$v = (double) $t['estimated_time'] - (double) $t['work_hours'] + (double) $t['togo_hours'];
}
if (!isset($totals[$f])) {
$totals[$f] = 0;
}
$totals[$f] += $v;
$projects_totals[$t['projects_id']][$f] += $v;
} else {
$v = app::getArrayName($t, $f);
}
$content .= str_replace(array("\n\r", "\r", "\n", $separator), ' ', $v) . $separator;
}
$content .= "\n";
if ($format == 'csv') {
echo chr(0xff) . chr(0xfe) . mb_convert_encoding($content, 'UTF-16LE', 'UTF-8');
} else {
echo $content;
}
}
$content = '';
//adding totals
if (isset($projects_totals[$current_project_id]) and !$request->hasParameter('projects_id')) {
foreach ($fields as $f) {
$v = '';
if (in_array($f, array('estimated_time', 'work_hours'))) {
$v = $projects_totals[$current_project_id][$f];
} elseif (strstr($f, 'extra_field_')) {
if (isset($projects_totals[$current_project_id][str_replace('extra_field_', '', $f)])) {
$v = $projects_totals[$current_project_id][str_replace('extra_field_', '', $f)];
}
}
$content .= str_replace(array("\n\r", "\r", "\n", $separator), ' ', $v) . $separator;
}
$content .= "\n\n";
}
foreach ($fields as $f) {
$v = '';
if (in_array($f, array('estimated_time', 'work_hours'))) {
$v = $totals[$f];
} elseif (strstr($f, 'extra_field_')) {
if (isset($totals[str_replace('extra_field_', '', $f)])) {
$v = $totals[str_replace('extra_field_', '', $f)];
}
}
$content .= str_replace(array("\n\r", "\r", "\n", $separator), ' ', $v) . $separator;
}
$content .= "\n";
if ($format == 'csv') {
echo chr(0xff) . chr(0xfe) . mb_convert_encoding($content, 'UTF-16LE', 'UTF-8');
} else {
echo $content;
}
exit;
}
}
示例11: link_to
<td><?php
echo $discussions['Users']['name'];
?>
</td>
<?php
$v = ExtraFieldsList::getValuesList($extra_fields, $discussions['id']);
echo ExtraFieldsList::renderListingTbody($extra_fields, $v);
$totals = ExtraFieldsList::getListingTotals($totals, $extra_fields, $v);
?>
<?php
if (!$sf_request->hasParameter('projects_id')) {
?>
<td><?php
echo link_to(app::getArrayName($discussions, 'Projects'), 'projectsComments/index?projects_id=' . $discussions['projects_id']);
?>
</td>
<?php
}
?>
</tr>
<?php
}
?>
</tbody>
<?php
if (count($discussions_list) > 0 and count($totals) > 0) {
?>