當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Flyspray::strtotime方法代碼示例

本文整理匯總了PHP中Flyspray::strtotime方法的典型用法代碼示例。如果您正苦於以下問題:PHP Flyspray::strtotime方法的具體用法?PHP Flyspray::strtotime怎麽用?PHP Flyspray::strtotime使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Flyspray的用法示例。


在下文中一共展示了Flyspray::strtotime方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: show

 function show()
 {
     global $page, $db, $user, $fs, $proj;
     $page->setTitle($fs->prefs['page_title'] . L('reports'));
     $events = array(1 => L('taskopened'), 13 => L('taskreopened'), 2 => L('taskclosed'), 3 => L('taskedited'), 14 => L('assignmentchanged'), 29 => L('events.useraddedtoassignees'), 4 => L('commentadded'), 5 => L('commentedited'), 6 => L('commentdeleted'), 7 => L('attachmentadded'), 8 => L('attachmentdeleted'), 11 => L('relatedadded'), 12 => L('relateddeleted'), 9 => L('notificationadded'), 10 => L('notificationdeleted'), 17 => L('reminderadded'), 18 => L('reminderdeleted'));
     $user_events = array(30 => L('created'), 31 => L('deleted'));
     $page->assign('events', $events);
     $page->assign('user_events', $user_events);
     $sort = strtoupper(Get::enum('sort', array('desc', 'asc')));
     $where = array();
     $params = array();
     $orderby = '';
     switch (Get::val('order')) {
         case 'type':
             $orderby = "h.event_type {$sort}, h.event_date {$sort}";
             break;
         case 'user':
             $orderby = "user_id {$sort}, h.event_date {$sort}";
             break;
         case 'date':
         default:
             $orderby = "h.event_date {$sort}, h.event_type {$sort}";
     }
     foreach (Get::val('events', array()) as $eventtype) {
         $where[] = 'h.event_type = ?';
         $params[] = $eventtype;
     }
     $where = '(' . implode(' OR ', $where) . ')';
     if ($proj->id) {
         $where = $where . 'AND (t.project_id = ?  OR h.event_type > 29) ';
         $params[] = $proj->id;
     }
     if (($fromdate = Req::val('fromdate')) || Req::val('todate')) {
         $where .= ' AND ';
         $todate = Req::val('todate');
         if ($fromdate) {
             $where .= ' h.event_date > ?';
             $params[] = Flyspray::strtotime($fromdate) + 0;
         }
         if ($todate && $fromdate) {
             $where .= ' AND h.event_date < ?';
             $params[] = Flyspray::strtotime($todate) + 86400;
         } else {
             if ($todate) {
                 $where .= ' h.event_date < ?';
                 $params[] = Flyspray::strtotime($todate) + 86400;
             }
         }
     }
     $histories = array();
     if (count(Get::val('events'))) {
         if (Get::num('event_number') > 0) {
             $db->setLimit(Get::num('event_number'));
         }
         $histories = $db->x->getAll("SELECT h.*, t.*, p.project_prefix\n                                             FROM {history} h\n                                        LEFT JOIN {tasks} t ON h.task_id = t.task_id\n                                        LEFT JOIN {projects} p ON t.project_id = p.project_id\n                                            WHERE {$where}\n                                         ORDER BY {$orderby}", null, $params);
     }
     $page->assign('histories', $histories);
     $page->assign('sort', $sort);
     $page->pushTpl('reports.tpl');
 }
開發者ID:negram,項目名稱:flyspray,代碼行數:60,代碼來源:reports.php

示例2: get_task_list


//.........這裏部分代碼省略.........
        }
        /// }}}
        $order_keys = array('id' => 't.task_id', 'project' => 'project_title', 'tasktype' => 'tasktype_name', 'dateopened' => 'date_opened', 'summary' => 'item_summary', 'severity' => 'task_severity', 'category' => 'lc.category_name', 'status' => 'is_closed, item_status', 'dueversion' => 'lvc.list_position', 'duedate' => 'due_date', 'progress' => 'percent_complete', 'lastedit' => 'max_date', 'priority' => 'task_priority', 'openedby' => 'uo.real_name', 'reportedin' => 't.product_version', 'assignedto' => 'u.real_name', 'dateclosed' => 't.date_closed', 'os' => 'los.os_name', 'votes' => 'num_votes', 'attachments' => 'num_attachments', 'comments' => 'num_comments', 'private' => 'mark_private', 'supertask' => 't.supertask_id');
        // make sure that only columns can be sorted that are visible (and task severity, since it is always loaded)
        $order_keys = array_intersect_key($order_keys, array_merge(array_flip($visible), array('severity' => 'task_severity')));
        // Implementing setting "Default order by"
        if (!array_key_exists('order', $args)) {
            # now also for $proj->id=0 (allprojects)
            $orderBy = $proj->prefs['sorting'][0]['field'];
            $sort = $proj->prefs['sorting'][0]['dir'];
            if (count($proj->prefs['sorting']) > 1) {
                $orderBy2 = $proj->prefs['sorting'][1]['field'];
                $sort2 = $proj->prefs['sorting'][1]['dir'];
            } else {
                $orderBy2 = 'severity';
                $sort2 = 'DESC';
            }
        } else {
            $orderBy = $args['order'];
            $sort = $args['sort'];
            $orderBy2 = 'severity';
            $sort2 = 'desc';
        }
        // TODO: Fix this! If something is already ordered by task_id, there's
        // absolutely no use to even try to order by something else also.
        $order_column[0] = $order_keys[Filters::enum(array_get($args, 'order', $orderBy), array_keys($order_keys))];
        $order_column[1] = $order_keys[Filters::enum(array_get($args, 'order2', $orderBy2), array_keys($order_keys))];
        $sortorder = sprintf('%s %s, %s %s, t.task_id ASC', $order_column[0], Filters::enum(array_get($args, 'sort', $sort), array('asc', 'desc')), $order_column[1], Filters::enum(array_get($args, 'sort2', $sort2), array('asc', 'desc')));
        $having = array();
        $dates = array('duedate' => 'due_date', 'changed' => $maxdatesql, 'opened' => 'date_opened', 'closed' => 'date_closed');
        foreach ($dates as $post => $db_key) {
            $var = $post == 'changed' ? 'having' : 'where';
            if ($date = array_get($args, $post . 'from')) {
                ${$var}[] = '(' . $db_key . ' >= ' . Flyspray::strtotime($date) . ')';
            }
            if ($date = array_get($args, $post . 'to')) {
                ${$var}[] = '(' . $db_key . ' <= ' . Flyspray::strtotime($date) . ' AND ' . $db_key . ' > 0)';
            }
        }
        if (array_get($args, 'string')) {
            $words = explode(' ', strtr(array_get($args, 'string'), '()', '  '));
            $comments = '';
            $where_temp = array();
            if (array_get($args, 'search_in_comments')) {
                $comments .= " OR c.comment_text {$LIKEOP} ?";
            }
            if (array_get($args, 'search_in_details')) {
                $comments .= " OR t.detailed_desc {$LIKEOP} ?";
            }
            foreach ($words as $word) {
                $likeWord = '%' . str_replace('+', ' ', trim($word)) . '%';
                $where_temp[] = "(t.item_summary {$LIKEOP} ? OR t.task_id = ? {$comments})";
                array_push($sql_params, $likeWord, intval($word));
                if (array_get($args, 'search_in_comments')) {
                    array_push($sql_params, $likeWord);
                }
                if (array_get($args, 'search_in_details')) {
                    array_push($sql_params, $likeWord);
                }
            }
            $where[] = '(' . implode(array_get($args, 'search_for_all') ? ' AND ' : ' OR ', $where_temp) . ')';
        }
        if ($user->isAnon()) {
            $where[] = 't.mark_private = 0 AND p.others_view = 1';
            if (array_key_exists('status', $args)) {
                if (in_array('closed', $args['status']) && !in_array('open', $args['status'])) {
開發者ID:canneverbe,項目名稱:flyspray,代碼行數:67,代碼來源:class.backend.php

示例3: array_push

     array_push($values, Post::val('bulk_reportedver'));
 }
 if (!Post::val('bulk_due_version') == 0) {
     array_push($columns, 'closedby_version');
     array_push($values, Post::val('bulk_due_version'));
 }
 # TODO Does the user has similiar rights in current and target projects?
 # TODO Does a task has subtasks? What happens to them? What if they are open/closed?
 # But: Allowing task dependencies between tasks in different projects is a feature!
 if (!Post::val('bulk_projects') == 0) {
     array_push($columns, 'project_id');
     array_push($values, Post::val('bulk_projects'));
 }
 if (!is_null(Post::val('bulk_due_date'))) {
     array_push($columns, 'due_date');
     array_push($values, Flyspray::strtotime(Post::val('bulk_due_date')));
 }
 //only process if one of the task fields has been updated.
 if (!array_count_values($columns) == 0 && Post::val('ids')) {
     //add the selected task id's to the query string
     $task_ids = Post::val('ids');
     $valuesAndTasks = array_merge_recursive($values, $task_ids);
     //execute the database update on all selected queries
     $update = $db->Query("UPDATE  {tasks}\n                                     SET  " . join('=?, ', $columns) . "=?\n                                   WHERE" . substr(str_repeat(' task_id = ? OR ', count(Post::val('ids'))), 0, -3), $valuesAndTasks);
 }
 //Set the assignments
 if (Post::val('bulk_assignment')) {
     // Delete the current assignees for the selected tasks
     $db->Query("DELETE FROM {assigned} WHERE" . substr(str_repeat(' task_id = ? OR ', count(Post::val('ids'))), 0, -3), Post::val('ids'));
     // Convert assigned_to and store them in the 'assigned' table
     foreach ((array) Post::val('ids') as $id) {
開發者ID:kandran,項目名稱:flyspray,代碼行數:31,代碼來源:modify.inc.php

示例4: get_task_list

 /**
  * Returns an array of tasks (respecting pagination) and an ID list (all tasks)
  * @param array $args call by reference because we have to modifiy $_GET if we use default values from a user profile
  * @param array $visible
  * @param integer $offset
  * @param integer $comment
  * @param bool $perpage
  * @access public
  * @return array
  * @version 1.0
  */
 function get_task_list(&$args, $visible, $offset = 0, $perpage = null)
 {
     global $proj, $db, $user, $conf, $fs;
     /* build SQL statement {{{ */
     // Original SQL courtesy of Lance Conry http://www.rhinosw.com/
     $where = $sql_params = array();
     $select = '';
     $groupby = 't.task_id, ';
     $from = '             {tasks}         t
                  LEFT JOIN  {projects}      p   ON t.project_id = p.project_id
                  LEFT JOIN  {list_items} lr ON t.resolution_reason = lr.list_item_id
                  LEFT JOIN  {redundant} r ON t.task_id = r.task_id ';
     // Only join tables which are really necessary to speed up the db-query
     $from .= ' LEFT JOIN  {assigned} ass      ON t.task_id = ass.task_id ';
     $from .= ' LEFT JOIN  {users} u           ON ass.user_id = u.user_id ';
     if (array_get($args, 'dev') || in_array('assignedto', $visible)) {
         $select .= ' MIN(u.real_name)               AS assigned_to_name, ';
         $select .= ' COUNT(ass.user_id)    AS num_assigned, ';
     }
     if (array_get($args, 'only_primary')) {
         $from .= ' LEFT JOIN  {dependencies} dep  ON dep.dep_task_id = t.task_id ';
         $where[] = 'dep.depend_id IS null';
     }
     if (array_get($args, 'has_attachment')) {
         $where[] = 'attachment_count > 0';
     }
     // sortable default fields
     $order_keys = array('id' => 't.task_id %s', 'project' => 'project_title %s', 'dateopened' => 'date_opened %s', 'summary' => 'item_summary %s', 'progress' => 'percent_complete %s', 'lastedit' => 'last_changed_time %s', 'openedby' => 'r.opened_by_real_name %s', 'closedby' => 'r.closed_by_real_name %s', 'changedby' => 'r.last_changed_by_real_name %s', 'assignedto' => 'u.real_name %s', 'dateclosed' => 't.date_closed %s', 'votes' => 'vote_count %s', 'attachments' => 'attachment_count %s', 'comments' => 'comment_count %s', 'state' => 'closed_by %1$s, is_closed %1$s', 'projectlevelid' => 'prefix_id %s', 'private' => 'mark_private %s');
     // custom sortable fields
     foreach ($proj->fields as $field) {
         if ($field->prefs['list_type'] == LIST_CATEGORY) {
             // consider hierarchical structure of categories
             $order_keys['field' . $field->id] = 'lcfield' . $field->id . '.lft %1$s, field' . $field->id . ' %1$s';
         } else {
             $order_keys['field' . $field->id] = 'field' . $field->id . ' %s';
         }
     }
     // Default user sort column and order
     if (!$user->isAnon()) {
         if (!isset($args['sort'])) {
             $args['sort'] = $user->infos['defaultorder'];
         }
         if (!isset($args['order'])) {
             $usercolumns = explode(' ', $user->infos['defaultsortcolumn']);
             foreach ($usercolumns as $column) {
                 if (isset($order_keys[$column])) {
                     $args['order'] = $column;
                     break;
                 }
             }
         }
     }
     // make sure that only columns can be sorted that are visible
     $order_keys = array_intersect_key($order_keys, array_flip($visible));
     $order_column[0] = $order_keys[Filters::enum(array_get($args, 'order', 'id'), array_keys($order_keys))];
     $order_column[1] = $order_keys[Filters::enum(array_get($args, 'order2', 'project'), array_keys($order_keys))];
     $order_column[0] = sprintf($order_column[0], strtoupper(Filters::enum(array_get($args, 'sort', 'desc'), array('asc', 'desc'))));
     $order_column[1] = sprintf($order_column[1], strtoupper(Filters::enum(array_get($args, 'sort2', 'desc'), array('asc', 'desc'))));
     $sortorder = sprintf('%s, %s, t.task_id ASC', $order_column[0], $order_column[1]);
     // search custom fields
     $custom_fields_joined = array();
     foreach ($proj->fields as $field) {
         $ref = 'field' . $field->id;
         if ($field->prefs['field_type'] == FIELD_DATE) {
             if (!array_get($args, 'field' . $field->id . 'from') && !array_get($args, 'field' . $field->id . 'to')) {
                 continue;
             }
             $from .= " LEFT JOIN {field_values} {$ref} ON t.task_id = {$ref}.task_id AND {$ref}.field_id = {$field->id} ";
             $custom_fields_joined[] = $field->id;
             if ($date = array_get($args, 'field' . $field->id . 'from')) {
                 $where[] = "({$ref}.field_value >= ?)";
                 $sql_params[] = Flyspray::strtotime($date);
             }
             if ($date = array_get($args, 'field' . $field->id . 'to')) {
                 $where[] = "({$ref}.field_value <= ? AND {$ref}.field_value > 0)";
                 $sql_params[] = Flyspray::strtotime($date);
             }
         } elseif ($field->prefs['field_type'] == FIELD_LIST) {
             if (in_array('', (array) array_get($args, 'field' . $field->id, array('')))) {
                 continue;
             }
             $from .= " LEFT JOIN {field_values} {$ref} ON t.task_id = {$ref}.task_id AND {$ref}.field_id = {$field->id} ";
             $custom_fields_joined[] = $field->id;
             $fwhere = array();
             foreach ($args['field' . $field->id] as $val) {
                 $fwhere[] = " {$ref}.field_value = ? ";
                 $sql_params[] = $val;
             }
             if (count($fwhere)) {
//.........這裏部分代碼省略.........
開發者ID:negram,項目名稱:flyspray,代碼行數:101,代碼來源:class.backend.php

示例5: add

# check field for update against allowed dbfields for quickedit.
# maybe FUTURE: add (dynamic read from database) allowed CUSTOM FIELDS checks for the project and user
# (if there is urgent request for implementing custom fields into Flyspray and using of tag-feature isn't enough to accomplish - like numbers/dates/timestamps as custom fields)
$allowedFields = array('due_date', 'item_status', 'percent_complete', 'task_type', 'product_category', 'task_severity', 'task_priority', 'product_version', 'closedby_version');
if ($proj->prefs['use_effort_tracking'] && $user->perms('track_effort')) {
    $allowedFields[] = 'estimated_effort';
}
if (!in_array(Post::val('name'), $allowedFields)) {
    header(':', true, 403);
    die(L('invalidfield'));
}
$value = Post::val('value');
# check if user is not sending manipulated invalid values
switch (Post::val('name')) {
    case 'due_date':
        $value = Flyspray::strtotime(Post::val('value'));
        $value = intval($value);
        break;
    case 'estimated_effort':
        $value = effort::EditStringToSeconds(Post::val('value'), $proj->prefs['hours_per_manday'], $proj->prefs['estimated_effort_format']);
        $value = intval($value);
        break;
    case 'task_priority':
    case 'task_severity':
        if (!preg_match("/^[1-5]\$/", $value)) {
            header(':', true, 403);
            die(L('invalidvalue'));
        }
        break;
    case 'percent_complete':
        if (!is_numeric($value) || $value < 0 || $value > 100) {
開發者ID:canneverbe,項目名稱:flyspray,代碼行數:31,代碼來源:quickedit.php

示例6: while

     while ($attachment = $db->FetchRow($check_attachments)) {
         $db->Query("DELETE from {attachments} WHERE attachment_id = ?", array($attachment['attachment_id']));
         @unlink(BASEDIR . '/attachments/' . $attachment['file_name']);
         Flyspray::logEvent($attachment['task_id'], 8, $attachment['orig_name']);
     }
     $_SESSION['SUCCESS'] = L('commentdeletedmsg');
     break;
     // ##################
     // adding a reminder
     // ##################
 // ##################
 // adding a reminder
 // ##################
 case 'details.addreminder':
     $how_often = Post::val('timeamount1', 1) * Post::val('timetype1');
     $start_time = Flyspray::strtotime(Post::val('timeamount2', 0));
     $userId = Flyspray::UsernameToId(Post::val('to_user_id'));
     if (!Backend::add_reminder($task['task_id'], Post::val('reminder_message'), $how_often, $start_time, $userId)) {
         Flyspray::show_error(L('usernotexist'));
         break;
     }
     $_SESSION['SUCCESS'] = L('reminderaddedmsg');
     break;
     // ##################
     // removing a reminder
     // ##################
 // ##################
 // removing a reminder
 // ##################
 case 'deletereminder':
     if (!$user->perms('manage_project') || !is_array(Post::val('reminder_id'))) {
開發者ID:manishkhanchandani,項目名稱:mkgxy,代碼行數:31,代碼來源:modify.inc.php

示例7: implode

    $where[] = 'h.event_type = ?';
    $params[] = $eventtype;
}
$where = '(' . implode(' OR ', $where) . ')';
if ($proj->id) {
    $where = $where . 'AND (t.project_id = ?  OR h.event_type > 29) ';
    $params[] = $proj->id;
}
if (($fromdate = Req::val('fromdate')) || Req::val('todate')) {
    $where .= ' AND ';
    $todate = Req::val('todate');
    if ($fromdate) {
        $where .= ' h.event_date > ?';
        $params[] = Flyspray::strtotime($fromdate) + 0;
    }
    if ($todate && $fromdate) {
        $where .= ' AND h.event_date < ?';
        $params[] = Flyspray::strtotime($todate) + 86400;
    } else {
        if ($todate) {
            $where .= ' h.event_date < ?';
            $params[] = Flyspray::strtotime($todate) + 86400;
        }
    }
}
if (count(Req::val('events'))) {
    $histories = $db->Query("SELECT h.*\n                        FROM  {history} h\n                   LEFT JOIN {tasks} t ON h.task_id = t.task_id\n                        WHERE {$where}\n                     ORDER BY {$orderby}", $params, Req::num('event_number', -1));
    $histories = $db->FetchAllArray($histories);
}
$page->uses('histories', 'sort');
$page->pushTpl('reports.tpl');
開發者ID:manishkhanchandani,項目名稱:mkgxy,代碼行數:31,代碼來源:reports.php

示例8: action_update_fields

 function action_update_fields()
 {
     global $fs, $db, $proj, $user;
     $types = Post::val('field_type');
     $names = Post::val('field_name');
     $lists = Post::val('list_id');
     $tense = Post::val('version_tense');
     $delete = Post::val('delete');
     $force = Post::val('force_default');
     $required = Post::val('value_required');
     foreach (Post::val('id', array()) as $id) {
         if (isset($delete[$id])) {
             $num = $db->x->execParam('DELETE FROM {fields} WHERE field_id = ? AND project_id = ?', array($id, $proj->id));
             // sort of permission check (the query below does not check project_id)
             if ($num) {
                 $db->x->execParam('DELETE FROM {field_values} WHERE field_id = ?', $id);
             }
             continue;
         }
         $default[$id] = Post::val('field' . $id, 0);
         if ($types[$id]['field_type'] == FIELD_DATE && $default[$id]) {
             $default[$id] = Flyspray::strtotime($default[$id]);
         }
         $db->x->execParam('UPDATE {fields} SET field_name = ?, field_type = ?, list_id = ?, value_required = ?,
                                         version_tense = ?, default_value = ?, force_default = ?
                      WHERE field_id = ? AND project_id = ?', array($names[$id], $types[$id], array_get($lists, $id, null), array_get($required, $id, 0), array_get($tense, $id, 0), $default[$id], array_get($force, $id, 0), $id, $proj->id));
     }
     $proj = new Project($proj->id);
     return array(SUBMIT_OK, L('fieldsupdated'));
 }
開發者ID:negram,項目名稱:flyspray,代碼行數:30,代碼來源:admin.php

示例9: read

 /**
  * Returns a correct value for the field based on user input
  * @access public
  * @param string $input
  * @return string
  */
 function read($input)
 {
     global $user, $db;
     switch ($this->prefs['field_type']) {
         case FIELD_DATE:
             $value = $input ? Flyspray::strtotime($input) : '';
             // this would be a unix timestamp
             if (is_numeric($input)) {
                 $value = $input;
             }
             break;
         case FIELD_TEXT:
             $value = (string) $input;
             break;
         case FIELD_LIST:
             if ($this->prefs['list_type'] == LIST_CATEGORY) {
                 $check = $db->x->GetOne('SELECT count(*)
                                         FROM {list_category}
                                        WHERE list_id = ? AND category_id = ?', null, array($this->prefs['list_id'], $input));
             } else {
                 $check = $db->x->GetOne('SELECT count(*)
                                         FROM {list_items}
                                        WHERE list_id = ? AND list_item_id = ?', null, array($this->prefs['list_id'], $input));
             }
             $value = $check ? $input : 0;
             break;
         case FIELD_USER:
             // try to determine a valid user ID if necessary
             $value = Flyspray::UserNameOrId($input);
             break;
     }
     if (!$value || $this->prefs['force_default'] && !$user->perms('modify_all_tasks')) {
         $value = $this->prefs['default_value'];
     }
     return $value;
 }
開發者ID:negram,項目名稱:flyspray,代碼行數:42,代碼來源:class.field.php

示例10: get_task_list


//.........這裏部分代碼省略.........
                     $temp .= ' a.user_id is NULL  OR';
                 } else {
                     foreach ($db_key as $singleDBKey) {
                         if (strpos($singleDBKey, '_name') !== false) {
                             $temp .= ' ' . $singleDBKey . ' LIKE ? OR ';
                             $sql_params[] = '%' . $val . '%';
                         } elseif (is_numeric($val)) {
                             $temp .= ' ' . $singleDBKey . ' = ? OR';
                             $sql_params[] = $val;
                         }
                     }
                 }
             }
             // Add the subcategories to the query
             if ($key == 'cat') {
                 $result = $db->Query('SELECT  *
                                         FROM  {list_category}
                                        WHERE  category_id = ?', array($val));
                 $cat_details = $db->FetchRow($result);
                 $result = $db->Query('SELECT  *
                                         FROM  {list_category}
                                        WHERE  lft > ? AND rgt < ? AND project_id  = ?', array($cat_details['lft'], $cat_details['rgt'], $cat_details['project_id']));
                 while ($row = $db->FetchRow($result)) {
                     $temp .= ' product_category = ?  OR';
                     $sql_params[] = $row['category_id'];
                 }
             }
         }
         if ($temp) {
             $where[] = '(' . substr($temp, 0, -3) . ')';
         }
     }
     /// }}}
     $having = array();
     $dates = array('duedate' => 'due_date', 'changed' => $maxdatesql, 'opened' => 'date_opened', 'closed' => 'date_closed');
     foreach ($dates as $post => $db_key) {
         $var = $post == 'changed' ? 'having' : 'where';
         if ($date = array_get($args, $post . 'from')) {
             ${$var}[] = '(' . $db_key . ' >= ' . Flyspray::strtotime($date) . ')';
         }
         if ($date = array_get($args, $post . 'to')) {
             ${$var}[] = '(' . $db_key . ' <= ' . Flyspray::strtotime($date) . ' AND ' . $db_key . ' > 0)';
         }
     }
     if (array_get($args, 'string')) {
         $words = explode(' ', strtr(array_get($args, 'string'), '()', '  '));
         $comments = '';
         $where_temp = array();
         if (array_get($args, 'search_in_comments')) {
             $comments .= 'OR c.comment_text LIKE ?';
         }
         if (array_get($args, 'search_in_details')) {
             $comments .= 'OR t.detailed_desc LIKE ?';
         }
         foreach ($words as $word) {
             $likeWord = '%' . str_replace('+', ' ', trim($word)) . '%';
             $where_temp[] = "(t.item_summary LIKE ? OR t.task_id = ? {$comments})";
             array_push($sql_params, $likeWord, intval($word));
             if (array_get($args, 'search_in_comments')) {
                 array_push($sql_params, $likeWord);
             }
             if (array_get($args, 'search_in_details')) {
                 array_push($sql_params, $likeWord);
             }
         }
         $where[] = '(' . implode(array_get($args, 'search_for_all') ? ' AND ' : ' OR ', $where_temp) . ')';
     }
     if (array_get($args, 'only_watched')) {
         //join the notification table to get watched tasks
         $from .= ' LEFT JOIN {notifications} fsn ON t.task_id = fsn.task_id';
         $where[] = 'fsn.user_id = ?';
         $sql_params[] = $user->id;
     }
     $where = count($where) ? 'WHERE ' . join(' AND ', $where) : '';
     // Get the column names of table tasks for the group by statement
     if (!strcasecmp($conf['database']['dbtype'], 'pgsql')) {
         $groupby .= "p.project_title, p.project_is_active, lst.status_name, lt.tasktype_name,{$order_column[0]},{$order_column[1]}, lr.resolution_name, ";
         $groupby .= $db->GetColumnNames('{tasks}', 't.task_id', 't.');
     } else {
         $groupby = 't.task_id';
     }
     $having = count($having) ? 'HAVING ' . join(' AND ', $having) : '';
     $sql = $db->Query("\n                          SELECT   t.*, {$select}\n                                   p.project_title, p.project_is_active,\n                                   lst.status_name AS status_name,\n                                   lt.tasktype_name AS task_type,\n                                   lr.resolution_name\n                          FROM     {$from}\n                          {$where}\n                          GROUP BY {$groupby}\n                          {$having}\n                          ORDER BY {$sortorder}", $sql_params);
     $tasks = $db->fetchAllArray($sql);
     $id_list = array();
     $limit = array_get($args, 'limit', -1);
     $task_count = 0;
     foreach ($tasks as $key => $task) {
         $id_list[] = $task['task_id'];
         if (!$user->can_view_task($task)) {
             unset($tasks[$key]);
             array_pop($id_list);
             --$task_count;
         } elseif (!is_null($perpage) && ($task_count < $offset || $task_count > $offset - 1 + $perpage || $limit > 0 && $task_count >= $limit)) {
             unset($tasks[$key]);
         }
         ++$task_count;
     }
     return array($tasks, $id_list);
 }
開發者ID:manishkhanchandani,項目名稱:mkgxy,代碼行數:101,代碼來源:class.backend.php

示例11: action_addreminder

 function action_addreminder($task)
 {
     global $user, $db, $fs, $proj;
     $how_often = Post::val('timeamount1', 1) * Post::val('timetype1');
     $start_time = Flyspray::strtotime(Post::val('timeamount2', 0));
     $userId = Flyspray::UsernameToId(Post::val('to_user_id'));
     if (!Backend::add_reminder($task['task_id'], Post::val('reminder_message'), $how_often, $start_time, $userId)) {
         return array(ERROR_RECOVER, L('usernotexist'));
     }
     return array(SUBMIT_OK, L('reminderaddedmsg'));
 }
開發者ID:negram,項目名稱:flyspray,代碼行數:11,代碼來源:details.php


注:本文中的Flyspray::strtotime方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。