本文整理汇总了PHP中app::getDateTimestamp方法的典型用法代码示例。如果您正苦于以下问题:PHP app::getDateTimestamp方法的具体用法?PHP app::getDateTimestamp怎么用?PHP app::getDateTimestamp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app
的用法示例。
在下文中一共展示了app::getDateTimestamp方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getEventsListByDate
public static function getEventsListByDate($timestamp, $users_id = null, $sf_user)
{
$html = '';
foreach (Events::getEventsListByDateQuery($timestamp, $users_id) as $events) {
$edit_action = '';
if ($sf_user->hasCredential('public_scheduler_access_full_access') and $users_id == null or $sf_user->hasCredential('allow_manage_personal_scheduler') and $users_id > 0) {
$edit_action = 'onClick="openModalBox(\'' . url_for('scheduler/edit?id=' . $events->getEventId() . '&users_id=' . $users_id) . '\')"';
}
if ($users_id == null and $events->getPublicStatus() == 1) {
$edit_action = '';
}
$event_name = '<a class="jt" href="#" onClick="return false" title="<b>' . __('Start Date') . ':</b> ' . app::dateTimeFormat($events->getStartDate()) . ' - <b>' . __('End Date') . ':</b> ' . app::dateTimeFormat($events->getEndDate()) . '" rel="' . url_for('scheduler/info?id=' . $events->getEventId()) . '">' . $events->getEventName() . '</a>';
$time = date('H:i', app::getDateTimestamp($events->getStartDate()));
if ($time != '00:00') {
$event_name = $time . ' ' . $event_name;
}
$html .= '<div class="eventItem" ' . $edit_action . '>' . $event_name . '</div>';
}
return $html;
}
示例2: 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;
}
}