• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Flyspray类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Flyspray的典型用法代码示例。如果您正苦于以下问题:PHP Flyspray类的具体用法?PHP Flyspray怎么用?PHP Flyspray使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Flyspray类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: area_prefs

 function area_prefs()
 {
     global $page, $user, $fs;
     $page->assign('groups', Flyspray::ListGroups());
     $page->assign('all_groups', Flyspray::listallGroups($user->id));
     $page->assign('theuser', $user);
     $page->setTitle($fs->prefs['page_title'] . L('editmydetails'));
 }
开发者ID:negram,项目名称:flyspray,代码行数:8,代码来源:myprofile.php


示例3: setTheme

 function setTheme($theme = '')
 {
     // Check available themes
     $themes = Flyspray::listThemes();
     if (in_array($theme, $themes)) {
         $this->_theme = $theme . '/';
     } else {
         $this->_theme = $themes[0] . '/';
     }
 }
开发者ID:heptalium,项目名称:flyspray,代码行数:10,代码来源:class.tpl.php


示例4: addEffort

 /**
  * Manually add effort to the effort table for this issue / user.
  *
  * @param $effort_to_add int Amount of Effort in hours to add to effort table.
  */
 public function addEffort($effort_to_add, $proj)
 {
     global $db;
     $effort = self::EditStringToSeconds($effort_to_add, $proj->prefs['hours_per_manday'], $proj->prefs['estimated_effort_format']);
     if ($effort === FALSE) {
         Flyspray::show_error(L('invalideffort'));
         return;
     }
     $db->Query('INSERT INTO  {effort}
                                      (task_id, date_added, user_id,start_timestamp,end_timestamp,effort)
                              VALUES  ( ?, ?, ?, ?,?,? )', array($this->_task_id, time(), $this->_userId, time(), time(), $effort));
 }
开发者ID:canneverbe,项目名称:flyspray,代码行数:17,代码来源:class.effort.php


示例5: execute_upgrade_file

function execute_upgrade_file($folder, $installed_version)
{
    global $db, $page, $conf;
    // At first the config file
    $upgrade_path = BASEDIR . '/upgrade/' . $folder;
    new ConfUpdater(CONFIG_PATH, $upgrade_path);
    $upgrade_info = parse_ini_file($upgrade_path . '/upgrade.info', true);
    // dev version upgrade?
    if ($folder == Flyspray::base_version($installed_version)) {
        $type = 'develupgrade';
    } else {
        $type = 'defaultupgrade';
    }
    // Next a mix of XML schema files and PHP upgrade scripts
    if (!isset($upgrade_info[$type])) {
        die('#1 Bad upgrade.info file.');
    }
    ksort($upgrade_info[$type]);
    foreach ($upgrade_info[$type] as $file) {
        if (substr($file, -4) == '.php') {
            require_once $upgrade_path . '/' . $file;
        }
        if (substr($file, -4) == '.xml') {
            $schema = new adoSchema($db->dblink);
            $xml = file_get_contents($upgrade_path . '/' . $file);
            $xml = str_replace('<table name="', '<table name="' . $conf['database']['dbprefix'], $xml);
            $schema->ParseSchemaString($xml);
            $schema->ExecuteSchema(null, true);
        }
    }
    // Last but not least global prefs update
    if (isset($upgrade_info['fsprefs'])) {
        $sql = $db->Query('SELECT pref_name FROM {prefs}');
        $existing = $db->FetchCol($sql);
        // Add what is missing
        foreach ($upgrade_info['fsprefs'] as $name => $value) {
            if (!in_array($name, $existing)) {
                $db->Query('INSERT INTO {prefs} (pref_name, pref_value) VALUES (?, ?)', array($name, $value));
            }
        }
        // Delete what is too much
        foreach ($existing as $name) {
            if (!isset($upgrade_info['fsprefs'][$name])) {
                $db->Query('DELETE FROM {prefs} WHERE pref_name = ?', array($name));
            }
        }
    }
    $db->Query('UPDATE {prefs} SET pref_value = ? WHERE pref_name = ?', array(basename($upgrade_path), 'fs_ver'));
    $page->assign('done', true);
}
开发者ID:manishkhanchandani,项目名称:mkgxy,代码行数:50,代码来源:upgrade.php


示例6: show

 function show($area = null)
 {
     global $page, $fs, $db, $proj, $user, $conf;
     $perpage = '20';
     if (isset($user->infos['tasks_perpage'])) {
         $perpage = $user->infos['tasks_perpage'];
     }
     $pagenum = max(1, Get::num('pagenum', 1));
     $offset = $perpage * ($pagenum - 1);
     // Get the visibility state of all columns
     $visible = explode(' ', trim($proj->id ? $proj->prefs['visible_columns'] : $fs->prefs['visible_columns']));
     if (!is_array($visible) || !count($visible) || !$visible[0]) {
         $visible = array('id');
     }
     list($tasks, $id_list) = Backend::get_task_list($_GET, $visible, $offset, $perpage);
     $page->assign('tasks', $tasks);
     $page->assign('offset', $offset);
     $page->assign('perpage', $perpage);
     $page->assign('pagenum', $pagenum);
     $page->assign('visible', $visible);
     // List of task IDs for next/previous links
     $_SESSION['tasklist'] = $id_list;
     $page->assign('total', count($id_list));
     // Javascript replacement
     if (Get::val('toggleadvanced')) {
         $advanced_search = intval(!Req::val('advancedsearch'));
         Flyspray::setCookie('advancedsearch', $advanced_search, time() + 60 * 60 * 24 * 30);
         $_COOKIE['advancedsearch'] = $advanced_search;
     }
     // Update check {{{
     if (Get::has('hideupdatemsg')) {
         unset($_SESSION['latest_version']);
     } else {
         if ($conf['general']['update_check'] && $user->perms('is_admin') && $fs->prefs['last_update_check'] < time() - 60 * 60 * 24 * 3) {
             if (!isset($_SESSION['latest_version'])) {
                 $latest = Flyspray::remote_request('http://flyspray.org/version.txt', GET_CONTENTS);
                 //if for some silly reason we get and empty response, we use the actual version
                 $_SESSION['latest_version'] = empty($latest) ? $fs->version : $latest;
                 $db->x->execParam('UPDATE {prefs} SET pref_value = ? WHERE pref_name = ?', array(time(), 'last_update_check'));
             }
         }
     }
     if (isset($_SESSION['latest_version']) && version_compare($fs->version, $_SESSION['latest_version'], '<')) {
         $page->assign('updatemsg', true);
     }
     // }}}
     $page->setTitle($fs->prefs['page_title'] . $proj->prefs['project_title'] . ': ' . L('tasklist'));
     $page->pushTpl('index.tpl');
 }
开发者ID:negram,项目名称:flyspray,代码行数:49,代码来源:index.php


示例7: add_related

function add_related($arr)
{
    global $log, $col, $db;
    static $imported = array();
    $task = $arr[1] . $arr[2];
    list($prefix, $task) = explode(strpos($task, '#') !== false ? '#' : ' ', $task);
    $task = Flyspray::GetTaskDetails($task, true, $prefix);
    if (!$task['task_id'] || isset($imported[$task['task_id'] . '-' . $log['version-name']])) {
        return;
    }
    echo sprintf('<p>&nbsp;&nbsp;&nbsp;Adding task %d for revision %d</p>', $task['task_id'], $log['version-name']);
    flush();
    $imported[$task['task_id'] . '-' . $log['version-name']] = true;
    $db->x->execParam("INSERT INTO {related} (this_task, related_task, {$col}) VALUES (?,?,?)", array($task['task_id'], $log['version-name'], RELATED_SVN));
}
开发者ID:heptalium,项目名称:flyspray,代码行数:15,代码来源:svnimport.php


示例8: show

 function show()
 {
     global $db, $page, $fs;
     // Some possibly interesting information about the user
     $sql = $db->x->GetOne('SELECT count(*) FROM {comments} WHERE user_id = ?', null, $this->user->id);
     $page->assign('comments', $sql);
     $sql = $db->x->GetOne('SELECT count(*) FROM {tasks} WHERE opened_by = ?', null, $this->user->id);
     $page->assign('tasks', $sql);
     $sql = $db->x->GetOne('SELECT count(*) FROM {assigned} WHERE user_id = ?', null, $this->user->id);
     $page->assign('groups', Flyspray::listallGroups($this->user->id));
     $page->assign('assigned', $sql);
     $page->assign('theuser', $this->user);
     $page->setTitle($fs->prefs['page_title'] . L('viewprofile'));
     $page->pushTpl('profile.tpl');
 }
开发者ID:negram,项目名称:flyspray,代码行数:15,代码来源:user.php


示例9: imageAttachment

 function imageAttachment($matches)
 {
     global $db, $baseurl, $user;
     // we'll not blindly make images out of all attachments
     $ext = substr($matches[1], -3);
     if (!in_array($ext, array('png', 'jpg', 'gif'))) {
         return $matches[0];
     }
     $att = $db->x->getRow('SELECT * FROM {attachments} WHERE orig_name = ?', null, $matches[1]);
     $task = Flyspray::GetTaskDetails($att['task_id']);
     if ($att && $user->can_view_task($task)) {
         return sprintf('<img src="%s" alt="%s" />', Filters::noXSS($baseurl . '?getfile=' . $att['attachment_id']), Filters::noXSS($att['orig_name']));
     } else {
         return $matches[0];
     }
 }
开发者ID:negram,项目名称:flyspray,代码行数:16,代码来源:class.mediasyntax.php


示例10: addEffort

 /**
  * Manually add effort to the effort table for this issue / user.
  *
  * @param $effort_to_add int amount of effort in hh:mm to add to effort table.
  */
 public function addEffort($effort_to_add, $proj)
 {
     global $db;
     # note: third parameter seem useless, not used by EditStringToSeconds().., maybe drop it..
     $effort = self::EditStringToSeconds($effort_to_add, $proj->prefs['hours_per_manday'], $proj->prefs['estimated_effort_format']);
     if ($effort === FALSE) {
         Flyspray::show_error(L('invalideffort'));
         return false;
     }
     # quickfix to avoid useless table entries.
     if ($effort == 0) {
         Flyspray::show_error(L('zeroeffort'));
         return false;
     } else {
         $db->Query('INSERT INTO {effort}
             (task_id, date_added, user_id,start_timestamp,end_timestamp,effort)
             VALUES  ( ?, ?, ?, ?,?,? )', array($this->_task_id, time(), $this->_userId, time(), time(), $effort));
         return true;
     }
 }
开发者ID:rkCSD,项目名称:flyspray,代码行数:25,代码来源:class.effort.php


示例11: action_edit

 function action_edit()
 {
     foreach (Get::val('ids') as $task_id) {
         // Edit or close? If we have a resolution_reason, then close! otherwise, edit.
         if (Post::val('resolution_reason')) {
             Backend::close_task($task_id, Post::val('resolution_reason'), Post::val('closure_comment'), Post::val('mark100'));
         } elseif (count(Post::val('changes'))) {
             $task = Flyspray::GetTaskDetails($task_id);
             $args = $task;
             // import previous values
             foreach (Post::val('changes') as $change) {
                 $args[$change] = Post::val($change);
             }
             if (is_array($args['assigned_to'])) {
                 $args['assigned_to'] = implode(';', $task['assigned_to_uname']);
             }
             Backend::edit_task($task, $args);
         }
     }
     return array(SUBMIT_OK, L('masseditsuccessful'));
 }
开发者ID:heptalium,项目名称:flyspray,代码行数:21,代码来源:edit.php


示例12: action_sendmagic

 /**
  * action_sendmagic 
  * 
  * @access public
  * @return array
  */
 function action_sendmagic()
 {
     global $db, $baseurl;
     // Check that the username exists
     if (strpos(Post::val('user_name'), '@') === false) {
         $user = Flyspray::getUserDetails(Flyspray::UserNameToId(Post::val('user_name')));
     } else {
         $user_id = $db->x->GetOne('SELECT user_id FROM {users} WHERE email_address = ?', null, Post::val('user_name'));
         $user = Flyspray::getUserDetails($user_id);
     }
     // If the username doesn't exist, throw an error
     if (!is_array($user) || !count($user)) {
         return array(ERROR_RECOVER, L('usernotexist'));
     }
     $magic_url = md5(uniqid(mt_rand(), true));
     // Insert the random "magic url" into the user's profile
     $db->x->execParam('UPDATE {users}
                           SET magic_url = ?
                         WHERE user_id = ?', array($magic_url, $user['user_id']));
     Notifications::send($user['user_id'], ADDRESS_USER, NOTIFY_PW_CHANGE, array($baseurl, $magic_url));
     return array(SUBMIT_OK, L('magicurlsent'));
 }
开发者ID:negram,项目名称:flyspray,代码行数:28,代码来源:lostpw.php


示例13: 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


示例14: 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


示例15: logout

 public function logout()
 {
     // Set cookie expiry time to the past, thus removing them
     Flyspray::setcookie('flyspray_userid', '', time() - 60);
     Flyspray::setcookie('flyspray_passhash', '', time() - 60);
     Flyspray::setcookie('flyspray_project', '', time() - 60);
     if (Cookie::has(session_name())) {
         Flyspray::setcookie(session_name(), '', time() - 60);
     }
     // Unset all of the session variables.
     $_SESSION = array();
     session_destroy();
     return !$this->isAnon();
 }
开发者ID:canneverbe,项目名称:flyspray,代码行数:14,代码来源:class.user.php


示例16: VALUES

                                     VALUES  (?, ?)', array($id, $assignee));
                            }
                        }
                    }
                }
                // set success message
                $_SESSION['SUCCESS'] = L('tasksupdated');
                break;
            } else {
                if (!Post::val('resolution_reason')) {
                    Flyspray::show_error(L('noclosereason'));
                    break;
                }
                $task_ids = Post::val('ids');
                foreach ($task_ids as $task_id) {
                    $task = Flyspray::GetTaskDetails($task_id);
                    if (!$user->can_close_task($task)) {
                        continue;
                    }
                    if ($task['is_closed']) {
                        continue;
                    }
                    Backend::close_task($task_id, Post::val('resolution_reason'), Post::val('closure_comment', ''), Post::val('mark100', false));
                }
                $_SESSION['SUCCESS'] = L('taskclosedmsg');
                break;
            }
        } else {
            Flyspray::show_error(L('massopsdisabled'));
        }
}
开发者ID:kandran,项目名称:flyspray,代码行数:31,代码来源:modify.inc.php


示例17: die

<?php

/*
* Multiple Tasks Creation
*/
if (!defined('IN_FS')) {
    die('Do not access this file directly.');
}
if (!$user->can_open_task($proj) && !$user->perms('add_multiple_tasks')) {
    Flyspray::show_error(15);
}
$page->setTitle($fs->prefs['page_title'] . $proj->prefs['project_title'] . ': ' . L('newtask'));
$page->assign('old_assigned', '');
$page->pushTpl('newmultitasks.tpl');
开发者ID:canneverbe,项目名称:flyspray,代码行数:14,代码来源:newmultitasks.php


示例18: ON

                  FROM {related} r
             LEFT JOIN {tasks} t ON (r.related_task = t.task_id AND r.this_task = ? OR r.this_task = t.task_id AND r.related_task = ?)
             LEFT JOIN {list_status} s ON t.item_status = s.status_id
             LEFT JOIN {list_resolution} res ON t.resolution_reason = res.resolution_id
                 WHERE t.task_id is NOT NULL AND is_duplicate = 0 AND ( t.mark_private = 0 OR ? = 1 )
              ORDER BY t.task_id ASC', array($task_id, $task_id, $user->perms('manage_project')));
 $related_cleaned = Flyspray::weedOutTasks($user, $db->fetchAllArray($sql));
 $page->assign('related', $related_cleaned);
 $sql = $db->Query('SELECT t.*, r.*, s.status_name, res.resolution_name
                  FROM {related} r
             LEFT JOIN {tasks} t ON r.this_task = t.task_id
             LEFT JOIN {list_status} s ON t.item_status = s.status_id
             LEFT JOIN {list_resolution} res ON t.resolution_reason = res.resolution_id
                 WHERE is_duplicate = 1 AND r.related_task = ?
              ORDER BY t.task_id ASC', array($task_id));
 $duplicates_cleaned = Flyspray::weedOutTasks($user, $db->fetchAllArray($sql));
 $page->assign('duplicates', $duplicates_cleaned);
 $sql = $db->Query('SELECT *
                  FROM {notifications} n
             LEFT JOIN {users} u ON n.user_id = u.user_id
                 WHERE n.task_id = ?', array($task_id));
 $page->assign('notifications', $db->fetchAllArray($sql));
 $sql = $db->Query('SELECT *
                  FROM {reminders} r
             LEFT JOIN {users} u ON r.to_user_id = u.user_id
                 WHERE task_id = ?
              ORDER BY reminder_id', array($task_id));
 $page->assign('reminders', $db->fetchAllArray($sql));
 $page->pushTpl('details.tabs.tpl');
 if ($user->perms('view_comments') || $proj->prefs['others_view'] || $user->isAnon() && $task_details['task_token'] && Get::val('task_token') == $task_details['task_token']) {
     $page->pushTpl('details.tabs.comment.tpl');
开发者ID:krayon,项目名称:flyspray,代码行数:31,代码来源:details.php


示例19: process_command

 /**
  * Processes single command and performs some backend action
  *
  * @param FlySprayCommand $cmd
  * @param Backend $backend
  * @return mixed
  */
 private function process_command(FlySprayCommand $cmd, Backend &$backend)
 {
     $not_cackend_commands = array('active_user', 'get_task_details');
     if (!in_array($cmd->action, $not_cackend_commands) && !method_exists($backend, $cmd->action)) {
         throw new Exception('Needed action is not performed in Backend', API_ECODE_BACKEND_NOT_PORFORM);
     }
     global $db;
     switch ($cmd->action) {
         case 'active_user':
             // CommandActiveUser
             global $user;
             if ($user->infos['user_name'] != $cmd->id) {
                 $user_id = $db->x->GetOne('SELECT user_id FROM {users} WHERE user_name = ?', null, $cmd->id);
                 if (intval($user_id) > 0) {
                     $user = new User($user_id);
                 } else {
                     throw new Exception('ActiveUser can not be set', API_ECODE_SET_ACTIVE_USER);
                 }
             }
             break;
         case 'add_comment':
             // CommandAddComment
             if (!($task = Flyspray::GetTaskDetails($cmd->id))) {
                 throw new Exception('Cannot select task', API_ECODE_SELECT_TASK);
             }
             if (!($cid = $backend->add_comment($task, $cmd->ids[0]))) {
                 throw new Exception('Failed adding comment', API_ECODE_ADD_COMMENT);
             }
             return $cid;
         case 'close_task':
             // CommandCloseTask
             try {
                 $list_item_id = $this->get_list_item_id('resolution', 'fixed');
             } catch (Exception $exc) {
                 throw new Exception($exc->getMessage(), API_ECODE_CLOSE_TASK);
             }
             if (!$backend->close_task($cmd->id, $list_item_id, $cmd->ids['comment'], $cmd->ids['mark100'])) {
                 throw new Exception('Cannot close task', API_ECODE_CLOSE_TASK);
             }
             break;
         case 'edit_task':
             // CommandEditTask
             // default task fields, another fields should be treated as custom fields
             $def_fields = array('item_summary', 'project_id', 'percent_complete', 'assignedto');
             if (!($task = Flyspray::GetTaskDetails($cmd->id))) {
                 throw new Exception('Cannot select task', API_ECODE_SELECT_TASK);
             }
             $args = $task;
             $this->normalize_task_to_args($args);
             foreach ($cmd->ids as $param_key => $param_value) {
                 if (in_array($param_key, $def_fields)) {
                     $args[$param_key] = $param_value;
                 } else {
                     if (!($field = $db->x->getRow('SELECT * FROM {fields} WHERE field_name = ?', null, $param_key))) {
                         throw new Exception('Cannot find custom field row for ' . $param_key, API_ECODE_FIELD_NOT_FOUND);
                     }
                     if (!($field_val = $db->x->getRow("SELECT * FROM {list_items} WHERE list_id = ? AND item_name LIKE '%{$param_value}%'", null, $field['list_id']))) {
                         throw new Exception(sprintf('Cannot find field item row for %s like %s', $param_key, $param_value), API_ECODE_FIELD_VALUE_NOT_FOUND);
                     }
                     $args['field' . $field['field_id']] = $field_val['list_item_id'];
                 }
             }
             list($status_code, $msg) = $backend->edit_task($task, $args);
             if ($status_code != SUBMIT_OK) {
                 throw new Exception(sprintf('Failed editing task, status code is "%d", message is "%s"', $status_code, strval($msg)), API_ECODE_EDIT_TASK);
             }
             break;
         case 'assign_to_me':
             // CommandAssignToMe
             $user_to_assign = $db->x->getRow('SELECT * FROM {users} WHERE user_name = ?', null, $cmd->id);
             if (!$user_to_assign) {
                 throw new Exception(sprintf('Username "%s" is not found', $cmd->id), API_ECODE_USERNAME_NOT_FOUND);
             }
             $backend->assign_to_me($user_to_assign['user_id'], $cmd->ids);
             break;
         case 'get_task_details':
             if (!($task = Flyspray::GetTaskDetails($cmd->id))) {
                 throw new Exception('Cannot select task', API_ECODE_SELECT_TASK);
             }
             return $task;
         default:
             throw new Exception('Unrecognized command ' . $cmd->action, API_ECODE_UNRECOGNIZED_COMMAND);
     }
 }
开发者ID:negram,项目名称:flyspray,代码行数:91,代码来源:api.php


示例20: show_error

 /**
  * Shows an error message
  * @param string $error_message if it is an integer, an error message from the language file will be loaded
  * @param bool $die enable/disable redirection (if outside the database modification script)
  * @param string $advanced_info append a string to the error message
  * @param string $url alternate redirection
  * @access public static
  * @return void
  * @version 1.0
  * @notes if a success and error happens on the same page, a mixed error message will be shown
  * @todo is the if ($die) meant to be inside the else clause?
  */
 public static function show_error($error_message, $die = true, $advanced_info = null, $url = null)
 {
     global $modes, $baseurl;
     if (!is_int($error_message)) {
         // in modify.inc.php
         $_SESSION['ERROR'] = $error_message;
     } else {
         $_SESSION['ERROR'] = L('error#') . $error_message . ': ' . L('error' . $error_message);
         if (!is_null($advanced_info)) {
             $_SESSION['ERROR'] .= ' ' . $advanced_info;
         }
         if ($die) {
             Flyspray::Redirect(is_null($url) ? $baseurl : $url);
         }
     }
 }
开发者ID:korusdipl,项目名称:flyspray,代码行数:28,代码来源:class.flyspray.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Fn类代码示例发布时间:2022-05-23
下一篇:
PHP Flux类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap