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


PHP Flyspray::GetTaskDetails方法代碼示例

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


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

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

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

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

示例4: tpl_tasklink

function tpl_tasklink($task, $text = null, $strict = false, $attrs = array(), $title = array('status', 'summary', 'percent_complete'))
{
    global $user;
    $params = array();
    if (!is_array($task) || !isset($task['status_name'])) {
        $td_id = is_array($task) && isset($task['task_id']) ? $task['task_id'] : $task;
        $task = Flyspray::GetTaskDetails($td_id, true);
    }
    if ($strict === true && (!is_object($user) || !$user->can_view_task($task))) {
        return '';
    }
    if (is_object($user) && $user->can_view_task($task)) {
        $summary = utf8_substr($task['item_summary'], 0, 64);
    } else {
        $summary = L('taskmadeprivate');
    }
    if (is_null($text)) {
        $text = sprintf('FS#%d - %s', $task['task_id'], Filters::noXSS($summary));
    } elseif (is_string($text)) {
        $text = htmlspecialchars(utf8_substr($text, 0, 64), ENT_QUOTES, 'utf-8');
    } else {
        //we can't handle non-string stuff here.
        return '';
    }
    if (!$task['task_id']) {
        return $text;
    }
    $title_text = array();
    foreach ($title as $info) {
        switch ($info) {
            case 'status':
                if ($task['is_closed']) {
                    $title_text[] = $task['resolution_name'];
                    $attrs['class'] = 'closedtasklink';
                } else {
                    $title_text[] = $task['status_name'];
                }
                break;
            case 'summary':
                $title_text[] = $summary;
                break;
            case 'assignedto':
                if (isset($task['assigned_to_name'])) {
                    if (is_array($task['assigned_to_name'])) {
                        $title_text[] = implode(', ', $task['assigned_to_name']);
                    } else {
                        $title_text[] = $task['assigned_to_name'];
                    }
                }
                break;
            case 'percent_complete':
                $title_text[] = $task['percent_complete'] . '%';
                break;
            case 'category':
                if ($task['product_category']) {
                    if (!isset($task['category_name'])) {
                        $task = Flyspray::GetTaskDetails($task['task_id'], true);
                    }
                    $title_text[] = $task['category_name'];
                }
                break;
                // ... more options if necessary
        }
    }
    $title_text = implode(' | ', $title_text);
    // to store search options
    $params = $_GET;
    unset($params['do'], $params['action'], $params['task_id'], $params['switch']);
    if (isset($params['event_number'])) {
        # shorter links to tasks from report page
        unset($params['events'], $params['event_number'], $params['fromdate'], $params['todate'], $params['submit']);
    }
    # We can unset the project param for shorter urls because flyspray knows project_id from current task data.
    # Except we made a search from an 'all projects' view before, so the prev/next navigation on details page knows
    # if it must search only in the project of current task or all projects the user is allowed to see tasks.
    if (!isset($params['advancedsearch']) || isset($params['project']) && $params['project'] != 0) {
        unset($params['project']);
    }
    $url = htmlspecialchars(CreateURL('details', $task['task_id'], null, $params), ENT_QUOTES, 'utf-8');
    $title_text = htmlspecialchars($title_text, ENT_QUOTES, 'utf-8');
    $link = sprintf('<a href="%s" title="%s" %s>%s</a>', $url, $title_text, join_attrs($attrs), $text);
    if ($task['is_closed']) {
        $link = '<del>&#160;' . $link . '&#160;</del>';
    }
    return $link;
}
開發者ID:rkCSD,項目名稱:flyspray,代碼行數:86,代碼來源:class.tpl.php

示例5: list

    $args['item_summary'] = "Task {$i} ({$subject})";
    // 'detailed_desc'
    // echo $args['item_summary'] . "\r\n";
    $ok = Backend::create_task($args);
    if ($ok === 0) {
        echo "Failed to create task.\r\n";
    } else {
        list($id, $token) = $ok;
        $db->Query('UPDATE {tasks} SET opened_by = ?, date_opened = ? WHERE task_id = ?', array($reporter, $opened, $id));
    }
}
// One task in ten of is unconfirmed, probably just bullshit, not assigned to anyone,
// and we add just a comment "Cannot reproduce".
for ($i = 1; $i <= $maxcomments; $i++) {
    $taskid = rand(2, $maxtasks + 1);
    $task = Flyspray::GetTaskDetails($taskid, true);
    $project = $task['project_id'];
    $added = time() - rand(1, 315360000);
    // Find someone who is allowed to add comment, do not use global groups
    $sqltext = "SELECT uig.user_id\n                         FROM {users_in_groups} uig\n                         JOIN {groups} g ON g.group_id = uig.group_id AND g.add_comments = 1\n                          AND (g.project_id = 0 OR g.project_id = ?)\n                        WHERE g.group_id NOT IN (1, 2, 7, 8, 9)\n                     ORDER BY {$RANDOP} ";
    $sql = $db->Query($sqltext, array($project));
    $row = $db->FetchRow($sql);
    $reporter = new User($row['user_id']);
    // User might still not be able to add a comment, if he can not see the task...
    // Just try again until a suitable one comes out from the query. It will finally.
    // Try to enhance the query also to return fewer unsuitable ones.
    while (!$reporter->can_view_task($task)) {
        $row = $db->FetchRow($sql);
        $reporter = new User($row['user_id']);
    }
    $comment = 'Comment.';
開發者ID:kandran,項目名稱:flyspray,代碼行數:31,代碼來源:CreateTestData.php

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

示例7: die

<?php

/********************************************************\
  | Task Dependancy Graph                                  |
  | ~~~~~~~~~~~~~~~~~~~~~                                  |
  \********************************************************/
/**
 * XXX: This stuff looks incredible ugly, rewrite me for 1.0
 */
if (!defined('IN_FS')) {
    die('Do not access this file directly.');
}
if (!($task_details = Flyspray::GetTaskDetails(Req::num('task_id'))) || !$user->can_view_task($task_details)) {
    Flyspray::show_error(9);
}
$id = Req::num('task_id');
$page->assign('task_id', $id);
$prunemode = Req::num('prune', 0);
$selfurl = CreateURL('depends', $id);
$pmodes = array(L('none'), L('pruneclosedlinks'), L('pruneclosedtasks'));
foreach ($pmodes as $mode => $desc) {
    if ($mode == $prunemode) {
        $strlist[] = $desc;
    } else {
        $strlist[] = "<a href='" . htmlspecialchars($selfurl, ENT_QUOTES, 'utf-8') . ($mode != 0 ? "&amp;prune={$mode}" : "") . "'>{$desc}</a>\n";
    }
}
$page->uses('strlist');
$starttime = microtime();
$sql = 'SELECT t1.task_id AS id1, t1.item_summary AS sum1,
             t1.percent_complete AS pct1, t1.is_closed AS clsd1,
開發者ID:canneverbe,項目名稱:flyspray,代碼行數:31,代碼來源:depends.php

示例8: _onsubmit

 function _onsubmit()
 {
     $action = Req::val('action');
     list($type, $msg, $url) = $this->handle('action', $action, $this->task);
     if ($type != NO_SUBMIT) {
         $this->task = Flyspray::GetTaskDetails(Req::num('task_id'));
     }
     return array($type, $msg, $url);
 }
開發者ID:negram,項目名稱:flyspray,代碼行數:9,代碼來源:details.php

示例9: close_task

 /**
  * Closes a task
  * @param integer $task_id
  * @param integer $reason
  * @param string $comment
  * @param bool $mark100
  * @access public
  * @return bool
  * @version 1.0
  */
 function close_task($task_id, $reason, $comment, $mark100 = true)
 {
     global $db, $user, $fs;
     $task = Flyspray::GetTaskDetails($task_id);
     if (!$user->can_close_task($task)) {
         return false;
     }
     if ($task['is_closed']) {
         return false;
     }
     $db->x->autoExecute('{tasks}', array('date_closed' => time(), 'closed_by' => $user->id, 'closure_comment' => $comment, 'is_closed' => 1, 'resolution_reason' => $reason, 'last_edited_time' => time(), 'last_edited_by' => $user->id, 'percent_complete' => (bool) $mark100 * 100), MDB2_AUTOQUERY_UPDATE, sprintf('task_id = %d', $task_id));
     if ($mark100) {
         Flyspray::logEvent($task_id, 3, 100, $task['percent_complete'], 'percent_complete');
     }
     // [RED] Update last changed date
     $db->x->execParam('UPDATE {redundant} SET last_changed_time = ?,
                               last_changed_by_real_name = ?, last_changed_by_user_name = ?,
                               closed_by_real_name = ?, closed_by_user_name = ?
                         WHERE task_id = ?', array(time(), $user->infos['real_name'], $user->infos['user_name'], $user->infos['real_name'], $user->infos['user_name'], $task_id));
     Notifications::send($task_id, ADDRESS_TASK, NOTIFY_TASK_CLOSED);
     Flyspray::logEvent($task_id, 2, $reason, $comment);
     // If there's an admin request related to this, close it
     $db->x->autoExecute('{admin_requests}', array('resolved_by' => $user->id, 'time_resolved' => time()), MDB2_AUTOQUERY_UPDATE, sprintf('task_id = %d AND request_type = 1', $task_id));
     // duplicate
     if ($reason == $fs->prefs['resolution_dupe']) {
         $look = array('FS#', 'bug ');
         foreach ($fs->projects as $project) {
             $look[] = preg_quote($project['project_prefix'] . '#', '/');
         }
         preg_match("/\\b(" . implode('|', $look) . ")(\\d+)\\b/", $comment, $dupe_of);
         if (count($dupe_of) >= 2) {
             $existing = $db->x->getOne('SELECT count(*) FROM {related} WHERE this_task = ? AND related_task = ? AND related_type = 1', null, array($task_id, $dupe_of[1]));
             if (!$existing) {
                 $db->x->autoExecute('{related}', array('this_task' => $task_id, 'related_task' => $dupe_of[1], 'related_type' => 1));
             }
             Backend::add_vote($task['opened_by'], $dupe_of[1]);
         }
     }
     return true;
 }
開發者ID:negram,項目名稱:flyspray,代碼行數:50,代碼來源:class.backend.php

示例10: tpl_tasklink

function tpl_tasklink($task, $text = null, $strict = false, $attrs = array(), $title = array('status', 'summary', 'percent_complete'))
{
    global $user;
    $params = array();
    if (!is_array($task) || !isset($task['status_name'])) {
        $td_id = is_array($task) && isset($task['task_id']) ? $task['task_id'] : $task;
        $task = Flyspray::GetTaskDetails($td_id, true);
    }
    if ($strict === true && (!is_object($user) || !$user->can_view_task($task))) {
        return '';
    }
    if (is_object($user) && $user->can_view_task($task)) {
        $summary = utf8_substr($task['item_summary'], 0, 64);
    } else {
        $summary = L('taskmadeprivate');
    }
    if (is_null($text)) {
        $text = sprintf('FS#%d - %s', $task['task_id'], Filters::noXSS($summary));
    } elseif (is_string($text)) {
        $text = htmlspecialchars(utf8_substr($text, 0, 64), ENT_QUOTES, 'utf-8');
    } else {
        //we can't handle non-string stuff here.
        return '';
    }
    if (!$task['task_id']) {
        return $text;
    }
    $title_text = array();
    foreach ($title as $info) {
        switch ($info) {
            case 'status':
                if ($task['is_closed']) {
                    $title_text[] = $task['resolution_name'];
                    $attrs['class'] = 'closedtasklink';
                } else {
                    $title_text[] = $task['status_name'];
                }
                break;
            case 'summary':
                $title_text[] = $summary;
                break;
            case 'assignedto':
                if (isset($task['assigned_to_name'])) {
                    if (is_array($task['assigned_to_name'])) {
                        $title_text[] = implode(', ', $task['assigned_to_name']);
                    } else {
                        $title_text[] = $task['assigned_to_name'];
                    }
                }
                break;
            case 'percent_complete':
                $title_text[] = $task['percent_complete'] . '%';
                break;
            case 'category':
                if ($task['product_category']) {
                    if (!isset($task['category_name'])) {
                        $task = Flyspray::GetTaskDetails($task['task_id'], true);
                    }
                    $title_text[] = $task['category_name'];
                }
                break;
                // ... more options if necessary
        }
    }
    $title_text = implode(' | ', $title_text);
    // to store search options
    $params = $_GET;
    unset($params['do'], $params['action'], $params['task_id'], $params['switch']);
    $url = htmlspecialchars(CreateURL('details', $task['task_id'], null, $params), ENT_QUOTES, 'utf-8');
    $title_text = htmlspecialchars($title_text, ENT_QUOTES, 'utf-8');
    $link = sprintf('<a href="%s" title="%s" %s>%s</a>', $url, $title_text, join_attrs($attrs), $text);
    if ($task['is_closed']) {
        $link = '<del>&#160;' . $link . '&#160;</del>';
    }
    return $link;
}
開發者ID:jack-reiersen,項目名稱:flyspray,代碼行數:76,代碼來源:class.tpl.php

示例11: createTestData


//.........這裏部分代碼省略.........
        $password = $user_name;
        $time_zone = 0;
        // Assign different ones!
        $email = null;
        // $user_name . '@example.com';
        $group = 4;
        Backend::create_user($user_name, $password, $real_name, '', $email, 0, $time_zone, $group, 1);
    }
    // But that was not enough for all needed permission, so in practice, every
    // project also has between 1 AND 20 project groups.
    //
    // Must recreate, so rights for new projects get loaded. Otherwise,
    // even first user in database can't create tasks.
    $user = new User(1);
    // And that's why we've got $maxtasks opened within the last 10 years
    for ($i = 1; $i <= $maxtasks; $i++) {
        $project = rand(2, $maxproducts);
        // Find someone who is allowed to open a task, do not use global groups
        $sql = $db->Query("SELECT uig.user_id\n\t\t\tFROM {users_in_groups} uig\n\t\t\tJOIN {groups} g ON g.group_id = uig.group_id AND g.open_new_tasks = 1 AND (g.project_id = 0 OR g.project_id = ?)\n\t\t\tWHERE g.group_id NOT IN (1, 2, 7, 8, 9)\n\t\t\tORDER BY {$RANDOP} LIMIT 1", array($project));
        $reporter = $db->FetchOne($sql);
        $sql = $db->Query("SELECT category_id FROM {list_category}\n\t\t\tWHERE project_id = ?\n\t\t\tAND category_name <> 'root'\n\t\t\tORDER BY {$RANDOP} LIMIT 1", array($project));
        $category = $db->FetchOne($sql);
        $opened = time() - rand(1, 315360000);
        $args = array();
        $args['project_id'] = $project;
        $args['date_opened'] = time() - rand(1, 315360000);
        // 'last_edited_time' => time(),
        $args['opened_by'] = $reporter;
        $args['product_category'] = $category;
        $args['task_severity'] = 1;
        $args['task_priority'] = 1;
        // 'task_type', , 'product_version',
        // 'operating_system', , 'estimated_effort',
        // 'supertask_id',
        $sql = $db->Query("SELECT project_title FROM {projects} WHERE project_id = ?", array($project));
        $projectname = $db->FetchOne($sql);
        $subject = $subjects[rand(0, count($subjects) - 1)];
        $subject = sprintf($subject, $projectname);
        $args['item_summary'] = "Task {$i} ({$subject})";
        // 'detailed_desc'
        // echo $args['item_summary'] . "\r\n";
        $ok = Backend::create_task($args);
        if ($ok === 0) {
            echo "Failed to create task.\r\n";
        } else {
            list($id, $token) = $ok;
            $db->Query('UPDATE {tasks} SET opened_by = ?, date_opened = ? WHERE task_id = ?', array($reporter, $opened, $id));
        }
    }
    # end for maxtasks
    // One task in ten of is unconfirmed, probably just bullshit, not assigned to anyone,
    // and we add just a comment "Cannot reproduce".
    for ($i = 1; $i <= $maxcomments; $i++) {
        $taskid = rand(2, $maxtasks + 1);
        $task = Flyspray::GetTaskDetails($taskid, true);
        $project = $task['project_id'];
        $added = time() - rand(1, 315360000);
        // Find someone who is allowed to add comment, do not use global groups
        $sqltext = "SELECT uig.user_id\n\t\t\tFROM {users_in_groups} uig\n                         JOIN {groups} g ON g.group_id = uig.group_id AND g.add_comments = 1\n                          AND (g.project_id = 0 OR g.project_id = ?)\n                        WHERE g.group_id NOT IN (1, 2, 7, 8, 9)\n                     ORDER BY {$RANDOP} ";
        $sql = $db->Query($sqltext, array($project));
        $row = $db->FetchRow($sql);
        $reporter = new User($row['user_id']);
        // User might still not be able to add a comment, if he can not see the task...
        // Just try again until a suitable one comes out from the query. It will finally.
        // Try to enhance the query also to return fewer unsuitable ones.
        while (!$reporter->can_view_task($task)) {
            $row = $db->FetchRow($sql);
            $reporter = new User($row['user_id']);
        }
        $comment = 'Comment.';
        Backend::add_comment($task, $comment);
        $sql = $db->Query('SELECT MAX(comment_id) FROM {comments}');
        $comment_id = $db->FetchOne($sql);
        $db->Query('UPDATE {comments} SET user_id = ?, date_added = ? WHERE comment_id = ?', array($reporter->id, $added, $comment_id));
    }
    # end for maxcomments
    // And $maxattachments total, either to task or comment
    for ($i = 1; $i <= $maxattachments; $i++) {
        $sql = $db->Query("SELECT comment_id, task_id, user_id, date_added FROM {comments} ORDER BY {$RANDOP} LIMIT 1");
        list($comment_id, $task_id, $user_id, $date_added) = $db->FetchRow($sql);
        $fname = "Attachment {$i}";
        if (rand(1, 100) == 1) {
            $comment_id = 0;
        }
        $origname = getAttachmentDescription() . " {$i}";
        $db->Query("INSERT INTO  {attachments}\n                                     ( task_id, comment_id, file_name,\n                                       file_type, file_size, orig_name,\n                                       added_by, date_added)\n                             VALUES  (?, ?, ?, ?, ?, ?, ?, ?)", array($task_id, $comment_id, $fname, 'application/octet-stream', 1024, $origname, $user_id, $date_added));
    }
    // // But at least we have been able to solve approximately half of the tasks
    // Of course, many of the tasks are somehow related to each other, so add
    // parents, relationships, dependencies, duplicates etc. last.
    // Do this ones last, after creating all the other data.
    // Approximately 200 hundred of our projects are already closed or deleted.
    // Cannot be sure when using random...
    for ($i = 1; $i < 200; $i++) {
    }
    // Some of our developers AND project managers couldn't take all that AND have already left the premises
    // No wonder, because we've got those corporate AND individual users always complaining
    // AND whining, not to speak about our management.
    $db->dbClose();
}
開發者ID:krayon,項目名稱:flyspray,代碼行數:101,代碼來源:CreateTestData.php

示例12: dirname

require_once '../../scripts/index.php';
$baseurl = dirname(dirname($baseurl)) . '/';
// first, find out about the field we are going to edit
$classnames = explode(' ', Post::val('classname'));
$field = '';
foreach ($classnames as $name) {
    if (substr($name, 0, 5) == 'task_') {
        $field = Filters::noXSS(substr($name, 5));
    }
}
// spare unnecessary queries
if (!$field) {
    header('HTTP/1.1 400 Bad Request');
    exit;
}
$task = Flyspray::GetTaskDetails(Post::val('task_id'));
// we better not forget this one ;)
if (!$user->can_edit_task($task)) {
    header('HTTP/1.1 400 Bad Request');
    exit;
}
// pre build some HTML
$task['num_assigned'] = count($task['assigned_to']);
$task['assigned_to_name'] = reset($task['assigned_to_name']);
$prev = Filters::noXSS(str_replace("'", "\\'", tpl_draw_cell($task, $field, '<span class="%s %s">%s</span>')));
$id = sprintf('id="task%d_%s" name="task%d_%s"', $task['task_id'], $field, $task['task_id'], $field);
switch ($field) {
    case 'summary':
        echo '<input type="text" class="text" ' . $id . ' value="' . Filters::noXSS($task['item_summary']) . '" />';
        break;
    case 'project':
開發者ID:negram,項目名稱:flyspray,代碼行數:31,代碼來源:editfield.php

示例13: is_accessible

 /**
  * is_accessible 
  * 
  * @access public
  * @return bool
  */
 function is_accessible()
 {
     global $user;
     return ($this->task = Flyspray::GetTaskDetails(Get::num('task_id'))) && $user->can_view_task($this->task);
 }
開發者ID:negram,項目名稱:flyspray,代碼行數:11,代碼來源:depends.php

示例14: tpl_tasklink

function tpl_tasklink($task, $text = null, $strict = false, $attrs = array(), $title = array('state', 'summary', 'percent_complete'))
{
    global $user;
    $params = array();
    if (!is_array($task)) {
        $task = Flyspray::GetTaskDetails(Flyspray::GetTaskId($task), true);
    }
    if ($strict === true && (!is_object($user) || !$user->can_view_task($task))) {
        return '';
    }
    if (is_object($user) && $user->can_view_task($task)) {
        $summary = utf8_substr($task['item_summary'], 0, 64);
    } else {
        $summary = L('taskmadeprivate');
    }
    if (is_null($text)) {
        $text = sprintf('%s#%d - %s', $task['project_prefix'], $task['prefix_id'], Filters::noXSS($summary));
    } elseif (is_string($text)) {
        $text = Filters::noXSS(utf8_substr($text, 0, 64));
    } else {
        //we can't handle non-string stuff here.
        return '';
    }
    if (!$task['task_id']) {
        return $text;
    }
    $title_text = array();
    foreach ($title as $info) {
        switch ($info) {
            case 'state':
                if ($task['is_closed']) {
                    $title_text[] = L('closed');
                    $attrs['class'] = 'closedtasklink';
                } elseif ($task['closed_by']) {
                    $title_text[] = L('reopened');
                } else {
                    $title_text[] = L('open');
                }
                break;
            case 'summary':
                $title_text[] = $summary;
                break;
            case 'assignedto':
                if (isset($task['assigned_to_name'])) {
                    if (is_array($task['assigned_to_name'])) {
                        $title_text[] = implode(', ', $task['assigned_to_name']);
                    } else {
                        $title_text[] = $task['assigned_to_name'];
                    }
                }
                break;
            case 'percent_complete':
                $title_text[] = $task['percent_complete'] . '%';
                break;
            case 'age':
                $title_text[] = formatDate($task['date_opened']);
                break;
                // ... more options if necessary
        }
    }
    $title_text = implode(' | ', $title_text);
    $params = $_GET;
    unset($params['do'], $params['action'], $params['task_id'], $params['switch']);
    $url = Filters::noXSS(FSTpl::relativeUrl(CreateURL(array('details', 'task' . $task['task_id']), $params)));
    $title_text = Filters::noXSS($title_text);
    $link = sprintf('<a href="%s" title="%s" %s>%s</a>', $url, $title_text, join_attrs($attrs), $text);
    if ($task['is_closed']) {
        $link = '<del>&#160;' . $link . '&#160;</del>';
    }
    return $link;
}
開發者ID:heptalium,項目名稱:flyspray,代碼行數:71,代碼來源:class.tpl.php

示例15: Address

 function Address($task_id, $type)
 {
     global $db, $fs, $proj, $user;
     $users = array();
     $jabber_users = array();
     $email_users = array();
     $task_details = Flyspray::GetTaskDetails($task_id);
     // Get list of users from the notification tab
     $get_users = $db->Query('SELECT *
                            FROM {notifications} n
                            LEFT JOIN {users} u ON n.user_id = u.user_id
                            WHERE n.task_id = ?', array($task_id));
     while ($row = $db->FetchRow($get_users)) {
         if ($row['user_id'] == $user->id && !$user->infos['notify_own']) {
             continue;
         }
         if ($fs->prefs['user_notify'] == '1' && ($row['notify_type'] == NOTIFY_EMAIL || $row['notify_type'] == NOTIFY_BOTH) || $fs->prefs['user_notify'] == '2') {
             array_push($email_users, $row['email_address']);
         }
         if ($fs->prefs['user_notify'] == '1' && ($row['notify_type'] == NOTIFY_JABBER || $row['notify_type'] == NOTIFY_BOTH) || $fs->prefs['user_notify'] == '3') {
             array_push($jabber_users, $row['jabber_id']);
         }
     }
     // Get list of assignees
     $get_users = $db->Query('SELECT *
                            FROM {assigned} a
                            LEFT JOIN {users} u ON a.user_id = u.user_id
                            WHERE a.task_id = ?', array($task_id));
     while ($row = $db->FetchRow($get_users)) {
         if ($row['user_id'] == $user->id && !$user->infos['notify_own']) {
             continue;
         }
         if ($fs->prefs['user_notify'] == '1' && ($row['notify_type'] == NOTIFY_EMAIL || $row['notify_type'] == NOTIFY_BOTH) || $fs->prefs['user_notify'] == '2') {
             array_push($email_users, $row['email_address']);
         }
         if ($fs->prefs['user_notify'] == '1' && ($row['notify_type'] == NOTIFY_JABBER || $row['notify_type'] == NOTIFY_BOTH) || $fs->prefs['user_notify'] == '3') {
             array_push($jabber_users, $row['jabber_id']);
         }
     }
     // Now, we add the project contact addresses...
     // ...but only if the task is public
     if ($task_details['mark_private'] != '1' && in_array($type, Flyspray::int_explode(' ', $proj->prefs['notify_types']))) {
         $proj_emails = preg_split('/[\\s,;]+/', $proj->prefs['notify_email'], -1, PREG_SPLIT_NO_EMPTY);
         $proj_jids = explode(',', $proj->prefs['notify_jabber']);
         foreach ($proj_emails as $key => $val) {
             if (!empty($val) && !in_array($val, $email_users)) {
                 array_push($email_users, $val);
             }
         }
         foreach ($proj_jids as $key => $val) {
             if (!empty($val) && !in_array($val, $jabber_users)) {
                 array_push($jabber_users, $val);
             }
         }
         // End of checking if a task is private
     }
     // Send back two arrays containing the notification addresses
     return array($email_users, array_unique($jabber_users));
 }
開發者ID:manishkhanchandani,項目名稱:mkgxy,代碼行數:59,代碼來源:class.notify.php


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