예제 #1
0
 function add_tsiHint($stuff)
 {
     $current_user =& singleton("current_user");
     $errstr = "Failed to record new time sheet item hint. ";
     $username = $stuff["username"];
     $people = person::get_people_by_username();
     $personID = $people[$username]["personID"];
     $personID or alloc_error("Person " . $username . " not found.");
     $taskID = $stuff["taskID"];
     $projectID = $stuff["projectID"];
     $duration = $stuff["duration"];
     $comment = $stuff["comment"];
     $date = $stuff["date"];
     if ($taskID) {
         $task = new task();
         $task->set_id($taskID);
         $task->select();
         $projectID = $task->get_value("projectID");
         $extra = " for task " . $taskID;
     }
     $projectID or alloc_error(sprintf($errstr . "No project found%s.", $extra));
     $row_projectPerson = projectPerson::get_projectPerson_row($projectID, $current_user->get_id());
     $row_projectPerson or alloc_error($errstr . "The person(" . $current_user->get_id() . ") has not been added to the project(" . $projectID . ").");
     if ($row_projectPerson && $projectID) {
         // Add new time sheet item
         $tsiHint = new tsiHint();
         $d = $date or $d = date("Y-m-d");
         $tsiHint->set_value("date", $d);
         $tsiHint->set_value("duration", $duration);
         if (is_object($task)) {
             $tsiHint->set_value("taskID", sprintf("%d", $taskID));
         }
         $tsiHint->set_value("personID", $personID);
         $tsiHint->set_value("comment", $comment);
         $tsiHint->save();
         $ID = $tsiHint->get_id();
     }
     if ($ID) {
         return array("status" => "yay", "message" => $ID);
     } else {
         alloc_error($errstr . "Time hint not added.");
     }
 }
예제 #2
0
 * under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or (at
 * your option) any later version.
 * 
 * allocPSA is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
 * License for more details.
 * 
 * You should have received a copy of the GNU Affero General Public License
 * along with allocPSA. If not, see <http://www.gnu.org/licenses/>.
*/
define("NO_REDIRECT", 1);
require_once "../alloc.php";
//usleep(1000);
$t = tsiHint::parse_tsiHint_string($_REQUEST["tsiHint_item"]);
$people = person::get_people_by_username();
foreach ($t as $k => $v) {
    if ($v) {
        if ($k == "taskID") {
            $task = new task();
            $task->set_id($v);
            if ($task->select()) {
                $v = $task->get_id() . " " . $task->get_link();
            } else {
                $v = "Task " . $v . " not found.";
            }
        } else {
            if ($k == "username") {
                $name = $people[$v]["name"] or $name = $people[$v]["username"];
            }
예제 #3
0
파일: home.php 프로젝트: cjbayliss/alloc
            if ($item->render()) {
                include_template("templates/homeItemS.tpl");
            }
        }
    }
}
global $modules;
$current_user =& singleton("current_user");
foreach ($modules as $module_name => $module) {
    if ($module->home_items) {
        $home_items = array_merge((array) $home_items, $module->home_items);
    }
}
$TPL["home_items"] = $home_items;
if (isset($_POST["tsiHint_item"])) {
    $t = tsiHint::parse_tsiHint_string($_POST["tsiHint_item"]);
    if (is_numeric($t["duration"]) && $current_user->get_id()) {
        $tsiHint = new tsiHint();
        $tsi_row = $tsiHint->add_tsiHint($t);
        alloc_redirect($TPL["url_alloc_home"]);
    } else {
        alloc_error("Time hint not added. No duration set.");
        alloc_error(print_r($t, 1));
    }
}
$TPL["main_alloc_title"] = "Home Page - " . APPLICATION_NAME;
if ($_GET["media"] == "print") {
    include_template("templates/homePrintableM.tpl");
} else {
    include_template("templates/homeM.tpl");
}