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


PHP task::getTask方法代码示例

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


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

示例1: getTasksFromList

 /**
  * Return all open or all finished tasks of a given tasklist
  *
  * @param int $id Tasklist ID
  * @param int $status Status of the tasks (0 = finished, 1 = open)
  * @return array $tasks Details of the tasks
  */
 function getTasksFromList($id, $status = 1)
 {
     global $conn;
     $id = (int) $id;
     $status = (int) $status;
     $taskobj = new task();
     $sel = $conn->prepare("SELECT ID FROM tasks WHERE `liste` = ? AND `status` = ? ORDER BY `end`,`title` ASC");
     $sel->execute(array($id, $status));
     $tasks = array();
     while ($task = $sel->fetch()) {
         array_push($tasks, $taskobj->getTask($task["ID"]));
     }
     if (!empty($tasks)) {
         return $tasks;
     } else {
         return false;
     }
 }
开发者ID:veganaize,项目名称:Collabtive,代码行数:25,代码来源:class.tasklist.php

示例2: getProjectTrack

 function getProjectTrack($project, $user = 0, $task = 0, $start = 0, $end = 0, $lim = 50)
 {
     global $conn;
     $project = (int) $project;
     $user = (int) $user;
     $lim = (int) $lim;
     // make sure task is an array - this needs to be refactored
     if (!is_array($task)) {
         $task = array($task);
     }
     // make sure all the fields are ints
     for ($index = 0; $index < count($task); $index++) {
         $task[$index] = (int) $task[$index];
     }
     $task = join(',', $task);
     // $start = (int) $start; // those are strings, not numbers
     // $end = (int) $end; // those are strings, not numbers
     if ($user > 0) {
         $sql = "SELECT * FROM timetracker WHERE project = {$project} AND user = {$user}";
         $num = "SELECT COUNT(*) FROM timetracker WHERE project = {$project} AND user = {$user}";
         $order = " ORDER BY ended ASC";
     } else {
         $sql = "SELECT * FROM timetracker WHERE project = {$project}";
         $num = "SELECT COUNT(*) FROM timetracker WHERE project = {$project}";
         $order = " ORDER BY ended ASC";
     }
     if ($task > 0) {
         $sql .= " AND task in ({$task})";
         $num .= " AND task in ({$task})";
     }
     if ($start > 0 and $end > 0) {
         $start = strtotime($start);
         $end = strtotime($end . " +1 day");
         $end = $end - 1;
         $sql .= " AND ended >={$start} AND ended<={$end} ";
         $num .= " AND ended >={$start} AND ended<={$end} ";
     }
     if ($num) {
         $num = $conn->query($num)->fetch();
         $num = $num[0];
     } else {
         $num = 0;
     }
     $sql = $sql . $order;
     // needs to be refactored
     if ($lim > 0) {
         SmartyPaginate::connect();
         SmartyPaginate::setLimit($lim);
         SmartyPaginate::setTotal($num);
         $start = SmartyPaginate::getCurrentIndex();
         $lim = SmartyPaginate::getLimit();
         $limi = " LIMIT {$start},{$lim} ";
         $sql = $sql . $limi;
     }
     $sel = $conn->query($sql);
     $track = array();
     $ttask = new task();
     if (isset($sel)) {
         while ($data = @$sel->fetch()) {
             $endstring = date("H:i", $data["ended"]);
             $startstring = date("H:i", $data["started"]);
             $daystring = date(CL_DATEFORMAT, $data["ended"]);
             $tasks = $ttask->getTask($data["task"]);
             if (!empty($tasks)) {
                 $tasks = $tasks["title"];
                 $data["tname"] = $tasks;
             }
             $pname = $conn->query("SELECT name FROM projekte WHERE ID = {$data['project']}")->fetch();
             $pname = stripslashes($pname[0]);
             $uname = $conn->query("SELECT name FROM user WHERE ID = {$data['user']}")->fetch();
             $uname = stripslashes($uname[0]);
             $data["endstring"] = $endstring;
             $data["startstring"] = $startstring;
             $data["daystring"] = $daystring;
             $data["uname"] = $uname;
             $data["pname"] = $pname;
             $data["comment"] = stripslashes($data["comment"]);
             $data["comment"] = nl2br($data["comment"]);
             array_push($track, $data);
         }
     }
     if (!empty($track)) {
         return $track;
     } else {
         return false;
     }
 }
开发者ID:veganaize,项目名称:Collabtive,代码行数:87,代码来源:class.timetracker.php

示例3: project

     $template->display("error.tpl");
     die;
 }
 if (!chkproject($userid, $id)) {
     $errtxt = $langfile["notyourproject"];
     $noperm = $langfile["accessdenied"];
     $template->assign("errortext", "{$errtxt}<br>{$noperm}");
     $template->display("error.tpl");
     die;
 }
 $myproject = new project();
 $pro = $myproject->getProject($id);
 $projectname = $pro["name"];
 $title = $langfile['task'];
 $mytask = new task();
 $task = $mytask->getTask($tid);
 $members = $myproject->getProjectMembers($id, $myproject->countMembers($id));
 $tasklist = new tasklist();
 $tasklists = $tasklist->getProjectTasklists($id);
 $tl = $tasklist->getTasklist($task['liste']);
 $task['listid'] = $tl['ID'];
 $task['listname'] = $tl['name'];
 $tmp = $mytask->getUsers($task['ID']);
 if ($tmp) {
     foreach ($tmp as $value) {
         $task['users'][] = $value[0];
     }
 }
 $user = $mytask->getUser($task['ID']);
 $task['username'] = $user[1];
 $task['userid'] = $user[0];
开发者ID:veganaize,项目名称:Collabtive,代码行数:31,代码来源:managetask.php

示例4: task

     $template->assign("errortext", "Permission denied.");
     $template->assign("mode", "error");
     $template->display("error.tpl");
     die;
 }
 // create task and user instance
 $task = new task();
 $user = new user();
 // get track to edit
 $track = $tracker->getTrack($tid);
 // get username
 $member = $user->getProfile($track["user"]);
 $track["username"] = $member["name"];
 if ($track["task"] != 0) {
     // get task
     $thetask = $task->getTask($track["task"]);
     if (empty($thetask["title"])) {
         $taskname = substr($thetask["text"], 0, 30);
     } else {
         $taskname = substr($thetask["title"], 0, 30);
     }
     $track["taskname"] = $taskname;
 }
 $template->assign("track", $track);
 $newtasks = $task->getProjectTasks($id);
 $oldtasks = $task->getProjectTasks($id, false);
 if ($newtasks and $oldtasks) {
     $tasks = array_merge($newtasks, $oldtasks);
 } else {
     $tasks = $newtasks;
 }
开发者ID:Setrino,项目名称:collabtive,代码行数:31,代码来源:managetimetracker.php

示例5: getTasksFromList

 /**
  * Return all open or all finished tasks of a given tasklist
  *
  * @param int $id Tasklist ID
  * @param int $status Status of the tasks (0 = finished, 1 = open)
  * @return array $tasks Details of the tasks
  */
 function getTasksFromList($id, $status = 1)
 {
     $id = (int) $id;
     $status = (int) $status;
     $taskobj = new task();
     $sel = mysql_query("SELECT ID FROM tasks WHERE `liste` = {$id} AND `status` = {$status} ORDER BY ID DESC");
     $tasks = array();
     while ($task = mysql_fetch_array($sel)) {
         array_push($tasks, $taskobj->getTask($task["ID"]));
     }
     if (!empty($tasks)) {
         return $tasks;
     } else {
         return false;
     }
 }
开发者ID:janvalentik,项目名称:Collabtive,代码行数:23,代码来源:class.tasklist.php

示例6: getProjectTrack

    function getProjectTrack($project, $user = 0, $task = 0, $start = 0, $end = 0, $lim = 50)
    {
        $start = mysql_real_escape_string($start);
        $end = mysql_real_escape_string($end);
        $project = (int) $project;
        $user = (int) $user;
        $lim = (int) $lim;

        if ($user > 0)
        {
            $sql = "SELECT * FROM timetracker WHERE project = $project AND user = $user";
            $num = "SELECT COUNT(*) FROM timetracker WHERE project = $project AND user = $user";
            $order = " ORDER BY ended ASC";
        }
        else
        {
            $sql = "SELECT * FROM timetracker WHERE project = $project";
            $num = "SELECT COUNT(*) FROM timetracker WHERE project = $project";
            $order = " ORDER BY ended ASC";
        }

        if ($task > 0)
        {
            $sql .= " AND task = $task";
            $num .= " AND task = $task";
        }

        if ($start > 0 and $end > 0)
        {
            $start = strtotime($start);
            $end = strtotime($end . " +1 day");
            $end = $end - 1;
            $sql .= " AND ended >=$start AND ended<=$end ";
            $num .= " AND ended >=$start AND ended<=$end ";
        }

        if ($num)
        {
            $num = mysql_fetch_row(mysql_query($num));
            $num = $num[0];
        }
        else
        {
            $num = 0;
        }

        $sql = $sql . $order;
        SmartyPaginate::connect();
        SmartyPaginate::setLimit($lim);
        SmartyPaginate::setTotal($num);

        $start = SmartyPaginate::getCurrentIndex();
        $lim = SmartyPaginate::getLimit();

        $limi = " LIMIT $start,$lim ";
        $sql = $sql . $limi;

        $sel = mysql_query($sql);

        $track = array();
        $ttask = new task();

        if (isset($sel))
        {
            while ($data = @mysql_fetch_array($sel))
            {
                $endstring = date("H:i", $data["ended"]);
                $startstring = date("H:i", $data["started"]);
                $daystring = date("d.m.y", $data["ended"]);
                $tasks = $ttask->getTask($data["task"]);

                if (!empty($tasks))
                {
                    $tasks = $tasks["title"];
                    $data["tname"] = $tasks;
                }

                $pname = mysql_query("SELECT name FROM projekte WHERE ID = $data[project]");
                $pname = mysql_fetch_row($pname);
                $pname = stripslashes($pname[0]);

                $uname = mysql_query("SELECT name FROM user WHERE ID = $data[user]");
                $uname = mysql_fetch_row($uname);
                $uname = stripslashes($uname[0]);

                $data["endstring"] = $endstring;
                $data["startstring"] = $startstring;
                $data["daystring"] = $daystring;
                $data["uname"] = $uname;
                $data["pname"] = $pname;
                $data["comment"] = stripslashes($data["comment"]);
                $data["comment"] = nl2br($data["comment"]);
                array_push($track, $data);
            }
        }

        if (!empty($track))
        {
            return $track;
        }
//.........这里部分代码省略.........
开发者ID:janvalentik,项目名称:Collabtive,代码行数:101,代码来源:class.timetracker.php


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