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


PHP w2p_Database_Query::dbfnNowWithTZ方法代码示例

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


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

示例1: store

 public function store(CAppUI $AppUI = null)
 {
     global $AppUI;
     $perms = $AppUI->acl();
     $stored = false;
     $this->_error = $this->check();
     if (count($this->_error)) {
         return $this->_error;
     }
     $q = new w2p_Database_Query();
     if ($this->message_id && $perms->checkModuleItem('forums', 'edit', $this->forum_id)) {
         $q->setDelete('forum_visits');
         $q->addWhere('visit_message = ' . (int) $this->message_id);
         $q->exec();
         if ($msg = parent::store()) {
             return $msg;
         }
         $stored = true;
     }
     if (0 == $this->message_id && $perms->checkModuleItem('forums', 'add')) {
         $this->message_date = $q->dbfnNowWithTZ();
         if ($msg = parent::store()) {
             return $msg;
         }
         $q->addTable('forum_messages');
         $q->addQuery('count(message_id), MAX(message_date)');
         $q->addWhere('message_forum = ' . (int) $this->message_forum);
         $reply = $q->fetchRow();
         //update forum descriptor
         $forum = new CForum();
         $forum->load($AppUI, $this->message_forum);
         $forum->forum_message_count = $reply[0];
         /*
          * Note: the message_date here has already been adjusted for the
          *    timezone above, so don't do it again!
          */
         $forum->forum_last_date = $this->message_date;
         $forum->forum_last_id = $this->message_id;
         $forum->store($AppUI);
         $this->sendWatchMail(false);
         $stored = true;
     }
     return $stored;
 }
开发者ID:viniciusbudines,项目名称:sisnuss,代码行数:44,代码来源:forummessage.class.php

示例2: update_dep_dates

 public function update_dep_dates($task_id)
 {
     $q = new w2p_Database_Query();
     $newTask = new CTask();
     $newTask->load($task_id);
     // Do not update tasks that are not tracking dependencies
     if (!in_array($newTask->task_dynamic, self::$tracking_dynamics)) {
         return;
     }
     // load original task dates and calculate task time span
     $tsd = new w2p_Utilities_Date($newTask->task_start_date);
     $ted = new w2p_Utilities_Date($newTask->task_end_date);
     $duration = $tsd->calcDuration($ted);
     // reset start date
     $nsd = new w2p_Utilities_Date($newTask->get_deps_max_end_date($newTask));
     // prefer Wed 8:00 over Tue 16:00 as start date
     $nsd = $nsd->next_working_day();
     $new_start_date = $nsd->format(FMT_DATETIME_MYSQL);
     // Add task time span to End Date again
     $ned = new w2p_Utilities_Date();
     $ned->copy($nsd);
     $ned->addDuration($duration, '1');
     // make sure one didn't land on a non-working day
     $ned = $ned->next_working_day(true);
     // prefer tue 16:00 over wed 8:00 as an end date
     $ned = $ned->prev_working_day();
     $new_end_date = $ned->format(FMT_DATETIME_MYSQL);
     // update the db
     $q->addTable('tasks');
     $q->addUpdate('task_start_date', $new_start_date);
     $q->addUpdate('task_end_date', $new_end_date);
     $q->addUpdate('task_updated', "'" . $q->dbfnNowWithTZ() . "'", false, true);
     $q->addWhere('task_dynamic <> 1 AND task_id = ' . (int) $task_id);
     $q->exec();
     $q->clear();
     if ($newTask->task_parent != $newTask->task_id) {
         $newTask->updateDynamics();
     }
     return;
 }
开发者ID:eureka2,项目名称:web2project,代码行数:40,代码来源:tasks.class.php

示例3: if

				</a>
			</td>
		</tr>
		</table>
<?php 
    }
    ?>
	</td>
	<?php 
    if (w2PgetParam($_REQUEST, 'tab', 0) == 0) {
        ?>
	<td>
	       <?php 
        $q = new w2p_Database_Query();
        $q->addTable('user_access_log', 'ual');
        $q->addQuery('user_access_log_id, ( unix_timestamp( \'' . $q->dbfnNowWithTZ() . '\' ) - unix_timestamp( date_time_in ) ) / 3600 as 		hours, ( unix_timestamp( \'' . $q->dbfnNowWithTZ() . '\' ) - unix_timestamp( date_time_last_action ) ) / 3600 as idle, if(isnull(date_time_out) or date_time_out =\'0000-00-00 00:00:00\',\'1\',\'0\') as online');
        $q->addWhere('user_id = ' . (int) $row['user_id']);
        $q->addOrder('user_access_log_id DESC');
        $q->setLimit(1);
        $user_logs = $q->loadList();
        if ($user_logs) {
            foreach ($user_logs as $row_log) {
                if ($row_log['online'] == '1') {
                    echo '<span style="color: green">' . $row_log['hours'] . ' ' . $AppUI->_('hrs.') . '( ' . $row_log['idle'] . ' ' . $AppUI->_('hrs.') . ' ' . $AppUI->_('idle') . ') - ' . $AppUI->_('Online');
                } else {
                    echo '<span style="color: red">' . $AppUI->_('Offline');
                }
            }
        } else {
            echo '<span style="color: grey">' . $AppUI->_('Never Visited');
        }
开发者ID:viniciusbudines,项目名称:sisnuss,代码行数:31,代码来源:vw_usr.php

示例4: elseif

}
$action = $_REQUEST['action'];
$q = new w2p_Database_Query();
if ($action) {
    $history_description = w2PgetParam($_POST, 'history_description', '');
    $history_project = (int) w2PgetParam($_POST, 'history_project', 0);
    $userid = $AppUI->user_id;
    $perms =& $AppUI->acl();
    if ($action == 'add') {
        if (!canAdd('history')) {
            $AppUI->redirect('m=public&a=access_denied');
        }
        $q->addTable('history');
        $q->addInsert('history_table', "history");
        $q->addInsert('history_action', "add");
        $q->addInsert('history_date', "'" . $q->dbfnNowWithTZ() . "'");
        $q->addInsert('history_description', $history_description);
        $q->addInsert('history_user', $userid);
        $q->addInsert('history_project', $history_project);
        $okMsg = 'History added';
    } elseif ($action == 'update') {
        if (!canEdit('history')) {
            $AppUI->redirect('m=public&a=access_denied');
        }
        $q->addTable('history');
        $q->addUpdate('history_description', $history_description);
        $q->addUpdate('history_project', $history_project);
        $q->addWhere('history_id =' . $history_id);
        $okMsg = 'History updated';
    } elseif ($action == 'del') {
        if (!canDelete('history')) {
开发者ID:eureka2,项目名称:web2project,代码行数:31,代码来源:addedit.php

示例5: updateLastAction

 /**
  * @Function for update table user_acces_log in field date_time_lost_action
  */
 public function updateLastAction($last_insert_id)
 {
     if ($last_insert_id > 0) {
         $q = new w2p_Database_Query();
         $q->addTable('user_access_log');
         $q->addUpdate('date_time_last_action', "'" . $q->dbfnNowWithTZ() . "'", false, true);
         $q->addWhere('user_access_log_id = ' . $last_insert_id);
         $q->exec();
     }
 }
开发者ID:illuminate3,项目名称:web2project,代码行数:13,代码来源:CAppUI.class.php

示例6: store

 public function store(CAppUI $AppUI = null)
 {
     global $AppUI;
     $perms = $AppUI->acl();
     $stored = false;
     $this->w2PTrimAll();
     // ensure changes of state in checkboxes is captured
     $this->project_active = (int) $this->project_active;
     $this->project_private = (int) $this->project_private;
     $this->project_target_budget = filterCurrency($this->project_target_budget);
     $this->project_actual_budget = filterCurrency($this->project_actual_budget);
     // Make sure project_short_name is the right size (issue for languages with encoded characters)
     $this->project_short_name = mb_substr($this->project_short_name, 0, 10);
     if (empty($this->project_end_date)) {
         $this->project_end_date = null;
     }
     $this->_error = $this->check();
     if (count($this->_error)) {
         return $this->_error;
     }
     $this->project_id = (int) $this->project_id;
     // convert dates to SQL format first
     if ($this->project_start_date) {
         $date = new w2p_Utilities_Date($this->project_start_date);
         $this->project_start_date = $date->format(FMT_DATETIME_MYSQL);
     }
     if ($this->project_end_date) {
         $date = new w2p_Utilities_Date($this->project_end_date);
         $date->setTime(23, 59, 59);
         $this->project_end_date = $date->format(FMT_DATETIME_MYSQL);
     }
     if ($this->project_actual_end_date) {
         $date = new w2p_Utilities_Date($this->project_actual_end_date);
         $this->project_actual_end_date = $date->format(FMT_DATETIME_MYSQL);
     }
     // check project parents and reset them to self if they do not exist
     if (!$this->project_parent) {
         $this->project_parent = $this->project_id;
         $this->project_original_parent = $this->project_id;
     } else {
         $parent_project = new CProject();
         $parent_project->load($this->project_parent);
         $this->project_original_parent = $parent_project->project_original_parent;
     }
     if (!$this->project_original_parent) {
         $this->project_original_parent = $this->project_id;
     }
     /*
      * TODO: I don't like the duplication on each of these two branches, but I
      *   don't have a good idea on how to fix it at the moment...
      */
     $q = new w2p_Database_Query();
     $this->project_updated = $q->dbfnNowWithTZ();
     if ($this->project_id && $perms->checkModuleItem('projects', 'edit', $this->project_id)) {
         if ($msg = parent::store()) {
             return $msg;
         }
         $stored = true;
     }
     if (0 == $this->project_id && $perms->checkModuleItem('projects', 'add')) {
         $this->project_created = $q->dbfnNowWithTZ();
         if ($msg = parent::store()) {
             return $msg;
         }
         if (0 == $this->project_parent || 0 == $this->project_original_parent) {
             $this->project_parent = $this->project_id;
             $this->project_original_parent = $this->project_id;
             if ($msg = parent::store()) {
                 return $msg;
             }
         }
         $stored = true;
     }
     //split out related departments and store them seperatly.
     $q = new w2p_Database_Query();
     $q->setDelete('project_departments');
     $q->addWhere('project_id=' . (int) $this->project_id);
     $q->exec();
     $q->clear();
     if ($this->project_departments) {
         foreach ($this->project_departments as $department) {
             if ($department) {
                 $q->addTable('project_departments');
                 $q->addInsert('project_id', $this->project_id);
                 $q->addInsert('department_id', $department);
                 $q->exec();
                 $q->clear();
             }
         }
     }
     //split out related contacts and store them seperatly.
     $q->setDelete('project_contacts');
     $q->addWhere('project_id=' . (int) $this->project_id);
     $q->exec();
     $q->clear();
     if ($this->project_contacts) {
         foreach ($this->project_contacts as $contact) {
             if ($contact) {
                 $q->addTable('project_contacts');
                 $q->addInsert('project_id', $this->project_id);
//.........这里部分代码省略.........
开发者ID:eureka2,项目名称:web2project,代码行数:101,代码来源:projects.class.php

示例7: addHistory

function addHistory($table, $id, $action = 'modify', $description = '', $project_id = 0)
{
    global $AppUI;
    /*
     * TODO:
     * 1) description should be something like:
     * 		command(arg1, arg2...)
     *  The command should be as module_action
     *  for example:
     * 		forums_new('Forum Name', 'URL')
     *
     * This way, the history module will be able to display descriptions
     * using locale definitions:
     * 		"forums_new" -> "New forum '%s' was created" -> "Se ha creado un nuevo foro llamado '%s'"
     *
     * 2) project_id and module_id should be provided in order to filter history entries
     *
     */
    if (!w2PgetConfig('log_changes') || !$AppUI->isActiveModule('history')) {
        return;
    }
    $q = new w2p_Database_Query();
    $q->addTable('history');
    $q->addInsert('history_action', $action);
    $q->addInsert('history_item', $id);
    $q->addInsert('history_description', $description);
    $q->addInsert('history_user', $AppUI->user_id);
    $q->addInsert('history_date', "'" . $q->dbfnNowWithTZ() . "'", false, true);
    $q->addInsert('history_project', $project_id);
    $q->addInsert('history_table', $table);
    $q->exec();
    //echo db_error();
}
开发者ID:viniciusbudines,项目名称:sisnuss,代码行数:33,代码来源:main_functions.php

示例8: clearUpdateKey

 public function clearUpdateKey()
 {
     global $AppUI;
     $q = new w2p_Database_Query();
     $this->contact_updatekey = '';
     $this->contact_lastupdate = $q->dbfnNowWithTZ();
     $this->store($AppUI);
 }
开发者ID:eureka2,项目名称:web2project,代码行数:8,代码来源:contacts.class.php

示例9: __extract_from_vw_usr

/**
 * @param $row
 *
 * @return Array
 */
function __extract_from_vw_usr($row)
{
    $q = new w2p_Database_Query();
    $q->addTable('user_access_log', 'ual');
    $q->addQuery('user_access_log_id, ( unix_timestamp( \'' . $q->dbfnNowWithTZ() . '\' ) - unix_timestamp( date_time_in ) ) / 3600 as 		hours, ( unix_timestamp( \'' . $q->dbfnNowWithTZ() . '\' ) - unix_timestamp( date_time_last_action ) ) / 3600 as idle, if(isnull(date_time_out) or date_time_out =\'0000-00-00 00:00:00\',\'1\',\'0\') as online');
    $q->addWhere('user_id = ' . (int) $row['user_id']);
    $q->addOrder('user_access_log_id DESC');
    $q->setLimit(1);
    $user_logs = $q->loadList();
    return $user_logs;
}
开发者ID:illuminate3,项目名称:web2project,代码行数:16,代码来源:cleanup_functions.php

示例10: getCalendarEvents

 public function getCalendarEvents($userId, $days = 30)
 {
     /*
      * This list of fields - id, name, description, startDate, endDate,
      * updatedDate - are named specifically for the iCal creation.
      * If you change them, it's probably going to break.  So don't do that.
      */
     $q = new w2p_Database_Query();
     $q->addQuery('e.event_id as id');
     $q->addQuery('event_title as name');
     $q->addQuery('event_description as description');
     $q->addQuery('event_start_date as startDate');
     $q->addQuery('event_end_date as endDate');
     $q->addQuery("'" . $q->dbfnNowWithTZ() . "' as updatedDate");
     $q->addQuery('CONCAT(\'' . W2P_BASE_URL . '/index.php?m=calendar&a=view&event_id=' . '\', e.event_id) as url');
     $q->addQuery('projects.project_id, projects.project_name');
     $q->addTable('events', 'e');
     $q->leftJoin('projects', 'projects', 'e.event_project = projects.project_id');
     $q->addWhere('(event_start_date > ' . $q->dbfnNow() . ' OR event_end_date > ' . $q->dbfnNow() . ')');
     $q->addWhere('(event_start_date < ' . $q->dbfnDateAdd($q->dbfnNow(), $days, 'DAY') . ' OR event_end_date < ' . $q->dbfnDateAdd($q->dbfnNow(), $days, 'DAY') . ')');
     $q->innerJoin('user_events', 'ue', 'ue.event_id = e.event_id');
     $q->addWhere('ue.user_id = ' . $userId);
     $q->addOrder('event_start_date');
     return $q->loadList();
 }
开发者ID:eureka2,项目名称:web2project,代码行数:25,代码来源:calendar.class.php

示例11: gc

 public function gc()
 {
     global $AppUI;
     $max = $this->convertTime('max_lifetime');
     $idle = $this->convertTime('idle_time');
     // First pass is to kill any users that are logged in at the time of the session.
     $where = 'UNIX_TIMESTAMP() - UNIX_TIMESTAMP(session_updated) > ' . $idle . ' OR UNIX_TIMESTAMP() - UNIX_TIMESTAMP(session_created) > ' . $max;
     $q = new w2p_Database_Query();
     $q->addTable('user_access_log');
     $q->addUpdate('date_time_out', $q->dbfnNowWithTZ());
     $q2 = new w2p_Database_Query();
     $q2->addTable('sessions');
     $q2->addQuery('session_user');
     $q2->addWhere($where);
     $q->addWhere('user_access_log_id IN ( ' . $q2->prepare() . ' )');
     $q->exec();
     $q->clear();
     $q2->clear();
     // Now we simply delete the expired sessions.
     $q->setDelete('sessions');
     $q->addWhere($where);
     $q->exec();
     $q->clear();
     if (w2PgetConfig('session_gc_scan_queue')) {
         // We need to scan the event queue.  If $AppUI isn't created yet
         // And it isn't likely that it will be, we create it and run the
         // queue scanner.
         if (!isset($AppUI)) {
             $AppUI = new w2p_Core_CAppUI();
             $queue = new w2p_System_EventQueue();
             $queue->scan();
         }
     }
     return true;
 }
开发者ID:illuminate3,项目名称:web2project,代码行数:35,代码来源:Session.class.php

示例12: store

 public function store(CAppUI $AppUI)
 {
     $perms = $AppUI->acl();
     $stored = false;
     if (strpos($this->link_url, ':') === false && strpos($this->link_url, "//") === false) {
         $this->link_url = 'http://' . $this->link_url;
     }
     $this->_error = $this->check();
     if (count($this->_error)) {
         return $this->_error;
     }
     /*
      * TODO: I don't like the duplication on each of these two branches, but I
      *   don't have a good idea on how to fix it at the moment...
      */
     $q = new w2p_Database_Query();
     $this->link_date = $q->dbfnNowWithTZ();
     if ($this->link_id && $perms->checkModuleItem('links', 'edit', $this->link_id)) {
         if ($msg = parent::store()) {
             return $msg;
         }
         $stored = true;
     }
     if (0 == $this->link_id && $perms->checkModuleItem('links', 'add')) {
         if ($msg = parent::store()) {
             return $msg;
         }
         $stored = true;
     }
     return $stored;
 }
开发者ID:eureka2,项目名称:web2project,代码行数:31,代码来源:links.class.php

示例13: store

 /**
  * Stores the current task log in the database updating the task_log_updated
  * field appropriately. Then updates total hours worked cache on task.
  *
  * @return void
  *
  * @access public
  */
 public function store(CAppUI $AppUI = null)
 {
     global $AppUI;
     $perms = $AppUI->acl();
     $this->_error = $this->check();
     if (count($this->_error)) {
         return $this->_error;
     }
     $q = new w2p_Database_Query();
     $this->task_log_updated = $q->dbfnNowWithTZ();
     if ($this->task_log_date) {
         $date = new w2p_Utilities_Date($this->task_log_date);
         $this->task_log_date = $date->format(FMT_DATETIME_MYSQL);
     }
     $dot = strpos($this->task_log_hours, ':');
     if ($dot > 0) {
         $log_duration_minutes = sprintf('%.3f', substr($this->task_log_hours, $dot + 1) / 60.0);
         $this->task_log_hours = floor($this->task_log_hours) + $log_duration_minutes;
     }
     $this->task_log_hours = $this->task_log_hours;
     $this->task_log_costcode = cleanText($this->task_log_costcode);
     if ($this->task_log_id && $perms->checkModuleItem('task_log', 'edit', $this->task_log_id)) {
         if ($msg = parent::store()) {
             return $msg;
         }
         $stored = true;
         $this->updateHoursWorked($this->task_log_task);
     }
     if (0 == $this->task_log_id && $perms->checkModuleItem('task_log', 'add')) {
         $this->task_log_created = $q->dbfnNowWithTZ();
         if ($msg = parent::store()) {
             return $msg;
         }
         $stored = true;
         $this->updateHoursWorked($this->task_log_task);
     }
     return $stored;
 }
开发者ID:eureka2,项目名称:web2project,代码行数:46,代码来源:tasklogs.class.php


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