예제 #1
0
 function load_filter($defaults)
 {
     $current_user =& singleton("current_user");
     // display the list of project name.
     $db = new db_alloc();
     $page_vars = array_keys(timeSheetGraph::get_list_vars());
     $_FORM = get_all_form_data($page_vars, $defaults);
     if ($_FORM["applyFilter"] && is_object($current_user)) {
         // we have a new filter configuration from the user, and must save it
         if (!$_FORM["dontSave"]) {
             $url = $_FORM["url_form_action"];
             unset($_FORM["url_form_action"]);
             $current_user->prefs[$_FORM["form_name"]] = $_FORM;
             $_FORM["url_form_action"] = $url;
         }
     } else {
         // we haven't been given a filter configuration, so load it from user preferences
         $_FORM = $current_user->prefs[$_FORM["form_name"]];
     }
     $rtn["personOptions"] = page::select_options(person::get_username_list($_FORM["personID"]), $_FORM["personID"]);
     $rtn["dateFrom"] = $_FORM["dateFrom"];
     $rtn["dateTo"] = $_FORM["dateTo"];
     $rtn["personID"] = $_FORM["personID"];
     $rtn["groupBy"] = $_FORM["groupBy"];
     // GET
     $rtn["FORM"] = "FORM=" . urlencode(serialize($_FORM));
     return $rtn;
 }
예제 #2
0
파일: product.php 프로젝트: cjbayliss/alloc
function tf_list($selected = "", $remove_these = array())
{
    global $tflist;
    $temp = $tflist;
    foreach ($remove_these as $dud) {
        unset($temp[$dud]);
    }
    echo page::select_options($temp, $selected);
    return;
}
예제 #3
0
function show_transaction_new($template)
{
    global $TPL;
    global $tflist;
    $transaction = new transaction();
    $transaction->set_values();
    // wipe clean
    $TPL["display"] = "display:none";
    $TPL["tfList_dropdown"] = page::select_options($tflist, NULL, 500);
    $TPL["fromTfList_dropdown"] = page::select_options($tflist, NULL, 500);
    $TPL["transactionType_dropdown"] = page::select_options(transaction::get_transactionTypes());
    $TPL["status_dropdown"] = page::select_options(transaction::get_transactionStatii());
    $TPL["link"] = "";
    include_template($template);
}
예제 #4
0
function show_reminder_filter($template)
{
    $current_user =& singleton("current_user");
    global $TPL;
    if ($current_user->have_role("admin") || $current_user->have_role("manage")) {
        $TPL["reminderActiveOptions"] = page::select_options(array("1" => "Active", "0" => "Inactive"), $_REQUEST["filter_reminderActive"]);
        $db = new db_alloc();
        $db->query("SELECT username,personID FROM person WHERE personActive = 1 ORDER BY username");
        while ($db->next_record()) {
            $recipientOptions[$db->f("personID")] = $db->f("username");
        }
        $TPL["recipientOptions"] = page::select_options($recipientOptions, $_REQUEST["filter_recipient"]);
        include_template($template);
    }
}
예제 #5
0
function show_skills()
{
    global $TPL;
    global $talent;
    global $skills;
    global $skill_class;
    global $db;
    $skills = array("" => "Any skill");
    $query = "SELECT * FROM skill";
    if ($skill_class != "") {
        $query .= prepare(" WHERE skillClass='%s'", $skill_class);
    }
    $query .= " ORDER BY skillClass,skillName";
    $db->query($query);
    while ($db->next_record()) {
        $skill = new skill();
        $skill->read_db_record($db);
        $skills[$skill->get_id()] = sprintf("%s - %s", $skill->get_value('skillClass'), $skill->get_value('skillName'));
    }
    if ($skill_class != "" && !in_array($skills[$talent], $skills)) {
        $talent = "";
    }
    $TPL["skills"] = page::select_options($skills, $talent);
}
예제 #6
0
파일: config.php 프로젝트: cjbayliss/alloc
    $peeps[$p["personID"]] = $p["name"];
}
// get the default time sheet manager/admin options
$TPL["defaultTimeSheetManagerListText"] = get_person_list(config::get_config_item("defaultTimeSheetManagerList"));
$TPL["defaultTimeSheetAdminListText"] = get_person_list(config::get_config_item("defaultTimeSheetAdminList"));
$days = array("Sun" => "Sun", "Mon" => "Mon", "Tue" => "Tue", "Wed" => "Wed", "Thu" => "Thu", "Fri" => "Fri", "Sat" => "Sat");
$TPL["calendarFirstDayOptions"] = page::select_options($days, config::get_config_item("calendarFirstDay"));
$TPL["timeSheetPrintOptions"] = page::select_options($TPL["timeSheetPrintOptions"], $TPL["timeSheetPrint"]);
$commentTemplate = new commentTemplate();
$ops = $commentTemplate->get_assoc_array("commentTemplateID", "commentTemplateName");
$TPL["rssStatusFilterOptions"] = page::select_options(task::get_task_statii_array(true), config::get_config_item("rssStatusFilter"));
if (has("timeUnit")) {
    $timeUnit = new timeUnit();
    $rate_type_array = $timeUnit->get_assoc_array("timeUnitID", "timeUnitLabelB");
}
$TPL["timesheetRate_options"] = page::select_options($rate_type_array, config::get_config_item("defaultTimeSheetUnit"));
$TPL["main_alloc_title"] = "Setup - " . APPLICATION_NAME;
include_template("templates/configM.tpl");
function get_person_list($personID_array)
{
    global $peeps;
    $people = array();
    foreach ($personID_array as $personID) {
        $people[] = $peeps[$personID];
    }
    if (count($people) > 0) {
        return implode(", ", $people);
    } else {
        return "<i>none</i>";
    }
}
예제 #7
0
파일: client.php 프로젝트: cjbayliss/alloc
function show_comments()
{
    global $clientID;
    global $TPL;
    global $client;
    $TPL["commentsR"] = comment::util_get_comments("client", $clientID);
    $TPL["commentsR"] and $TPL["class_new_comment"] = "hidden";
    $interestedPartyOptions = $client->get_all_parties();
    $interestedPartyOptions = interestedParty::get_interested_parties("client", $client->get_id(), $interestedPartyOptions);
    $TPL["allParties"] = $interestedPartyOptions or $TPL["allParties"] = array();
    $TPL["entity"] = "client";
    $TPL["entityID"] = $client->get_id();
    $TPL["clientID"] = $client->get_id();
    $commentTemplate = new commentTemplate();
    $ops = $commentTemplate->get_assoc_array("commentTemplateID", "commentTemplateName", "", array("commentTemplateType" => "client"));
    $TPL["commentTemplateOptions"] = "<option value=\"\">Comment Templates</option>" . page::select_options($ops);
    include_template("../comment/templates/commentM.tpl");
}
예제 #8
0
 function get_one_comment_array($v = array(), $all_parties = array())
 {
     global $TPL;
     $current_user =& singleton("current_user");
     $new = $v;
     $token = new token();
     if ($token->select_token_by_entity_and_action("comment", $new["commentID"], "add_comment_from_email")) {
         if ($token->get_value("tokenHash")) {
             $new["hash"] = $token->get_value("tokenHash");
             $new["hashKey"] = "{Key:" . $new["hash"] . "}";
             $new["hashHTML"] = " <em class=\"faint\">" . $new["hashKey"] . "</em>";
         }
         $ip = interestedParty::get_interested_parties("comment", $new["commentID"]);
         foreach ((array) $ip as $email => $info) {
             $all_parties += $ip;
             if ($info["selected"]) {
                 $sel[] = $email;
             }
         }
         foreach ($all_parties as $email => $i) {
             in_array($email, (array) $sel) and $recipient_selected[] = $i["identifier"];
         }
         if (interestedParty::is_external("comment", $new["commentID"])) {
             $new["external"] = " loud";
             $label = "<em class='faint warn'>[ External Conversation ]</em>";
         } else {
             $label = "<em class='faint'>[ Internal Conversation ]</em>";
         }
         foreach ((array) $all_parties as $email => $info) {
             $recipient_ops[$info["identifier"]] = $info["name"] . " <" . $email . ">";
         }
         $new["recipient_editor"] = "<span class='nobr' style='width:100%;display:inline;' class='recipient_editor'>";
         $new["recipient_editor"] .= "<span class='noprint hidden' id='recipient_dropdown_" . $new["commentID"] . "'>\n                                    <form action='" . $TPL["url_alloc_updateRecipients"] . "' method='post'>\n                                      <select name='comment_recipients[]' multiple='true' data-callback='save_recipients'>\n                                      " . page::select_options($recipient_ops, $recipient_selected) . "\n                                      </select>\n                                      <input type='hidden' name='commentID' value='" . $new["commentID"] . "'>\n                                      <input type='submit' value='Go' style='display:none'>\n                                    </form>\n                                  </span>";
         $new["recipient_editor"] .= "<a class='magic recipient_editor_link' id='r_e_" . $new["commentID"] . "' style='text-decoration:none' href='#x'>" . $label . "</a>";
         $new["recipient_editor"] .= "</span>";
         $new["reply"] = '<a href="" class="noprint commentreply">reply</a>';
     }
     if ($v["timeSheetID"]) {
         $timeSheet = new timeSheet();
         $timeSheet->set_id($v["timeSheetID"]);
         $v["ts_label"] = " (Time Sheet #" . $timeSheet->get_id() . ")";
     }
     $new["attribution"] = comment::get_comment_attribution($v);
     $new["commentCreatedUserEmail"] = comment::get_comment_author_email($v);
     $s = commentTemplate::populate_string(config::get_config_item("emailSubject_taskComment"), $entity, $id);
     $new["commentEmailSubject"] = $s . " " . $new["hashKey"];
     if (!$_GET["commentID"] || $_GET["commentID"] != $v["commentID"]) {
         if ($options["showEditButtons"] && $new["comment_buttons"]) {
             $new["form"] = '<form action="' . $TPL["url_alloc_comment"] . '" method="post">';
             $new["form"] .= '<input type="hidden" name="entity" value="' . $v["commentType"] . '">';
             $new["form"] .= '<input type="hidden" name="entityID" value="' . $v["commentLinkID"] . '">';
             $new["form"] .= '<input type="hidden" name="commentID" value="' . $v["commentID"] . '">';
             $new["form"] .= '<input type="hidden" name="comment_id" value="' . $v["commentID"] . '">';
             $new["form"] .= $new["comment_buttons"];
             $new["form"] .= '<input type="hidden" name="sessID" value="' . $TPL["sessID"] . '">';
             $new["form"] .= '</form>';
         }
         $v["commentMimeParts"] and $files = unserialize($v["commentMimeParts"]);
         if (is_array($files)) {
             foreach ($files as $file) {
                 $new["files"] .= '<div align="center" style="float:left; display:inline; margin-right:14px;">';
                 $new["files"] .= "<a href=\"" . $TPL["url_alloc_getMimePart"] . "part=" . $file["part"] . "&entity=comment&id=" . $v["commentID"] . "\">";
                 $new["files"] .= get_file_type_image($file["name"]) . "<br>" . page::htmlentities($file["name"]);
                 $new["files"] .= " (" . get_size_label($file["size"]) . ")</a>";
                 $new["files"] .= '</div>';
             }
         }
         $v["commentEmailRecipients"] and $new["emailed"] = 'Emailed to ' . page::htmlentities($v["commentEmailRecipients"]);
     }
     return (array) $new;
 }
예제 #9
0
파일: task.php 프로젝트: cjbayliss/alloc
function show_comments()
{
    global $taskID;
    global $TPL;
    global $task;
    if ($_REQUEST["commentSummary"]) {
        $_REQUEST["showTaskHeader"] = true;
        $_REQUEST["clients"] = true;
        $TPL["commentsR"] = comment::get_list_summary($_REQUEST);
        $TPL["extra_page_links"] = '<a href="' . $TPL["url_alloc_task"] . 'taskID=' . $TPL["task_taskID"] . '&sbs_link=comments">Full</a>';
    } else {
        $TPL["commentsR"] = comment::util_get_comments("task", $taskID);
        $TPL["extra_page_links"] = '<a href="' . $TPL["url_alloc_task"] . 'taskID=' . $TPL["task_taskID"];
        $TPL["extra_page_links"] .= '&sbs_link=comments&commentSummary=true&maxCommentLength=50000000">Summary</a>';
    }
    $TPL["commentsR"] and $TPL["class_new_comment"] = "hidden";
    $TPL["allParties"] = $task->get_all_parties($task->get_value("projectID")) or $TPL["allParties"] = array();
    $TPL["entity"] = "task";
    $TPL["entityID"] = $task->get_id();
    if (has("project")) {
        $project = $task->get_foreign_object("project");
        $TPL["clientID"] = $project->get_value("clientID");
    }
    $commentTemplate = new commentTemplate();
    $ops = $commentTemplate->get_assoc_array("commentTemplateID", "commentTemplateName", "", array("commentTemplateType" => "task"));
    $TPL["commentTemplateOptions"] = "<option value=\"\">Comment Templates</option>" . page::select_options($ops);
    include_template("../comment/templates/commentM.tpl");
}
예제 #10
0
                    } else {
                        $query = prepare("SELECT * FROM task WHERE personID=%d ORDER BY taskName", $personID);
                    }
                    $db->query($query);
                    while ($db->next_record()) {
                        $task = new task();
                        $task->read_db_record($db);
                        if (substr($task->get_value("taskStatus"), 0, 6) != "closed") {
                            $parent_names[$task->get_id()] = $task->get_value('taskName');
                        }
                    }
                }
            }
        }
        $TPL["parentType"] = $parentType;
        $TPL["parentNameOptions"] = page::select_options($parent_names);
        include_template("templates/reminderSelectParentM.tpl");
        break;
    case 3:
        // reminder entry form
        $reminder = new reminder();
        if (isset($reminderID)) {
            $reminder->set_id($reminderID);
            $reminder->select();
            $parentType = $reminder->get_value('reminderType');
            $parentID = $reminder->get_value('reminderLinkID');
            $TPL["reminder_title"] = "Edit Reminder";
            $TPL["reminder_buttons"] = <<<EOD
<input type="hidden" name="reminder_id" value="{$reminderID}">
<button type="submit" name="reminder_delete" value="1" class="delete_button">Delete<i class="icon-trash"></i></button>
<button type="submit" name="reminder_update" value="1" class="save_button default">Save<i class="icon-ok-sign"></i></button>
예제 #11
0
 function load_task_filter($_FORM)
 {
     $current_user =& singleton("current_user");
     $db = new db_alloc();
     // Load up the forms action url
     $rtn["url_form_action"] = $_FORM["url_form_action"];
     $rtn["hide_field_options"] = $_FORM["hide_field_options"];
     //time Load up the filter bits
     has("project") and $rtn["projectOptions"] = project::get_list_dropdown($_FORM["projectType"], $_FORM["projectID"]);
     $_FORM["projectType"] and $rtn["projectType_checked"][$_FORM["projectType"]] = " checked";
     $ops = array("0" => "Nobody");
     $rtn["personOptions"] = page::select_options($ops + person::get_username_list($_FORM["personID"]), $_FORM["personID"]);
     $rtn["managerPersonOptions"] = page::select_options($ops + person::get_username_list($_FORM["managerID"]), $_FORM["managerID"]);
     $rtn["creatorPersonOptions"] = page::select_options(person::get_username_list($_FORM["creatorID"]), $_FORM["creatorID"]);
     $rtn["all_tags"] = task::get_tags(true);
     $rtn["tags"] = $_FORM["tags"];
     $taskType = new meta("taskType");
     $taskType_array = $taskType->get_assoc_array("taskTypeID", "taskTypeID");
     $rtn["taskTypeOptions"] = page::select_options($taskType_array, $_FORM["taskTypeID"]);
     $_FORM["taskView"] and $rtn["taskView_checked_" . $_FORM["taskView"]] = " checked";
     $taskStatii = task::get_task_statii_array();
     $rtn["taskStatusOptions"] = page::select_options($taskStatii, $_FORM["taskStatus"]);
     $_FORM["showDescription"] and $rtn["showDescription_checked"] = " checked";
     $_FORM["showDates"] and $rtn["showDates_checked"] = " checked";
     $_FORM["showCreator"] and $rtn["showCreator_checked"] = " checked";
     $_FORM["showAssigned"] and $rtn["showAssigned_checked"] = " checked";
     $_FORM["showTimes"] and $rtn["showTimes_checked"] = " checked";
     $_FORM["showPercent"] and $rtn["showPercent_checked"] = " checked";
     $_FORM["showPriority"] and $rtn["showPriority_checked"] = " checked";
     $_FORM["showTaskID"] and $rtn["showTaskID_checked"] = " checked";
     $_FORM["showManager"] and $rtn["showManager_checked"] = " checked";
     $_FORM["showProject"] and $rtn["showProject_checked"] = " checked";
     $_FORM["showTags"] and $rtn["showTags_checked"] = " checked";
     $_FORM["showParentID"] and $rtn["showParentID_checked"] = " checked";
     $arrow = " --&gt;";
     $taskDateOps = array("" => "", "new" => "New Tasks", "due_today" => "Due Today", "overdue" => "Overdue", "d_created" => "Date Created" . $arrow, "d_assigned" => "Date Assigned" . $arrow, "d_targetStart" => "Estimated Start" . $arrow, "d_targetCompletion" => "Estimated Completion" . $arrow, "d_actualStart" => "Date Started" . $arrow, "d_actualCompletion" => "Date Completed" . $arrow);
     $rtn["taskDateOptions"] = page::select_options($taskDateOps, $_FORM["taskDate"], 45, false);
     if (!in_array($_FORM["taskDate"], array("new", "due_today", "overdue"))) {
         $rtn["dateOne"] = $_FORM["dateOne"];
         $rtn["dateTwo"] = $_FORM["dateTwo"];
     }
     $task_num_ops = array("" => "All results", 1 => "1 result", 2 => "2 results", 3 => "3 results", 4 => "4 results", 5 => "5 results", 10 => "10 results", 15 => "15 results", 20 => "20 results", 30 => "30 results", 40 => "40 results", 50 => "50 results", 100 => "100 results", 150 => "150 results", 200 => "200 results", 300 => "300 results", 400 => "400 results", 500 => "500 results", 1000 => "1000 results", 2000 => "2000 results", 3000 => "3000 results", 4000 => "4000 results", 5000 => "5000 results", 10000 => "10000 results");
     $rtn["limitOptions"] = page::select_options($task_num_ops, $_FORM["limit"]);
     // unset vars that aren't necessary
     foreach ((array) $_FORM as $k => $v) {
         if (!$v) {
             unset($_FORM[$k]);
         }
     }
     // Get
     $rtn["FORM"] = "FORM=" . urlencode(serialize($_FORM));
     return $rtn;
 }
예제 #12
0
// Create an object to hold a commentTemplate
$commentTemplate = new commentTemplate();
// Load the commentTemplate from the database
$commentTemplateID = $_POST["commentTemplateID"] or $commentTemplateID = $_GET["commentTemplateID"];
if ($commentTemplateID) {
    $commentTemplate->set_id($commentTemplateID);
    $commentTemplate->select();
}
// Process submission of the form using the save button
if ($_POST["save"]) {
    $commentTemplate->read_globals();
    $commentTemplate->save();
    alloc_redirect($TPL["url_alloc_commentTemplateList"]);
    // Process submission of the form using the delete button
} else {
    if ($_POST["delete"]) {
        $commentTemplate->delete();
        alloc_redirect($TPL["url_alloc_commentTemplateList"]);
        exit;
    }
}
// Load data for display in the template
$commentTemplate->set_values();
$ops = array("" => "Comment Template Type", "task" => "Task", "timeSheet" => "Time Sheet", "project" => "Project", "client" => "Client", "invoice" => "Invoice", "productSale" => "Sale");
$TPL["commentTemplateTypeOptions"] = page::select_options($ops, $commentTemplate->get_value("commentTemplateType"));
$TPL["main_alloc_title"] = "Edit Comment Template - " . APPLICATION_NAME;
// Invoke the page's main template
include_template("templates/commentTemplateM.tpl");
?>

예제 #13
0
파일: item.php 프로젝트: cjbayliss/alloc
$db = new db_alloc();
$db->query("select * from item where itemID=%d", $itemID);
$db->next_record();
$item->read_db_record($db);
$item->set_values();
// new crap
if ($current_user->have_role("admin") || $current_user->have_role("manage")) {
    $users = array();
    $_db = new db_alloc();
    $_db->query("SELECT * FROM person ORDER BY username");
    while ($_db->next_record()) {
        $person = new person();
        $person->read_db_record($_db);
        $users[$person->get_id()] = $person->get_value('username');
    }
    $TPL["userSelect"] = "<select name=\"userID\">" . page::select_options($users, $current_user->get_id()) . "</select><br>\n";
} else {
    $TPL["userSelect"] = "";
}
$temp = mktime(0, 0, 0, date("m") + $_POST["timePeriod"], date("d"), date("Y"));
$whenToReturn = date("Y", $temp) . "-" . date("m", $temp) . "-" . date("d", $temp);
$today = date("Y") . "-" . date("m") . "-" . date("d");
if ($loanID) {
    $loan->set_id($loanID);
    $loan->select();
}
if ($_POST["borrowItem"]) {
    $db->query("select * from loan where itemID=%d and dateReturned='0000-00-00'", $itemID);
    if ($db->next_record()) {
        // if the item is already borrowed
        alloc_redirect($TPL["url_alloc_item"] . "itemID={$itemID}&badBorrow=true&error=already_borrowed");
예제 #14
0
파일: addItem.php 프로젝트: cjbayliss/alloc
}
//so that the user can edit the item later
$TPL["personID"] = $current_user->get_id();
// item types
$itemType = new meta("itemType");
$TPL["itemTypes"] = page::select_options($itemType->get_assoc_array("itemTypeID", "itemTypeID"), $item->get_value("itemType"));
// setup item list (for removals)
$item_list = array();
$db = new db_alloc();
$db->query("SELECT * FROM item ORDER BY itemName");
while ($db->next_record()) {
    $item = new item();
    $item->read_db_record($db);
    $item_list[$item->get_id()] = $item->get_value('itemName');
}
$TPL["item_list"] = page::select_options($item_list, "");
if ($_POST["edit_items"]) {
    $item = new item();
    $item->set_id($_POST["itemID"][0]);
    $item->select();
    if (count($_POST["itemID"]) < 1) {
        alloc_error("You Must Select An Item");
    } else {
        if (count($_POST["itemID"]) > 1) {
            alloc_error("Can Only Edit 1 Item At A Time");
        }
        $TPL["edit_options"] = "<table><tr>\n" . "  <td>Name: </td>\n" . "  <td colspan=\"2\"><input size=\"40\" type=\"text\" name=\"update_itemName\" value=\"" . $item->get_value("itemName") . "\"></td>\n" . "</tr><tr>\n" . "  <td>Notes: </td>\n" . "  <td colspan=\"2\"><input size=\"40\" type=\"text\" name=\"update_itemNotes\" value=\"" . $item->get_value("itemNotes") . "\"></td>\n" . "</tr><tr>\n" . "  <td>Type: </td>\n" . "  <td><select name=\"update_itemType\" value=\"" . $item->get_value("itemType") . "\">" . page::select_options($itemType->get_assoc_array("itemTypeID", "itemTypeID"), $item->get_value("itemType")) . "       </select>" . "    <input type=\"hidden\" name=\"update_itemID\" value=\"" . $item->get_id() . "\"></td>" . "  <td align=\"right\">" . '    <button type="submit" name="update_item" value="1" class="save_button">Save Changes<i class="icon-ok-sign"></i></button>' . " </td>\n" . "</tr><td colspan=\"3\"><hr></td></tr>\n" . "</tr></table>\n";
    }
}
$TPL["main_alloc_title"] = "Edit Items - " . APPLICATION_NAME;
include_template("templates/addItemM.tpl");
예제 #15
0
파일: person.php 프로젝트: cjbayliss/alloc
function show_skills_list()
{
    global $TPL;
    global $personID;
    global $skills;
    $db = new db_alloc();
    $query = prepare("SELECT * FROM proficiency WHERE personID=%d", $personID);
    $db->query($query);
    $skills_got = array();
    while ($db->next_record()) {
        $skill = new skill();
        $skill->read_db_record($db);
        array_push($skills_got, $skill->get_id());
    }
    $query = "SELECT * FROM skill ORDER BY skillClass";
    $db->query($query);
    while ($db->next_record()) {
        $skill = new skill();
        $skill->read_db_record($db);
        if (in_array($skill->get_id(), $skills_got)) {
            // dont show this item
        } else {
            $skills[$skill->get_id()] = sprintf("%s - %s", $skill->get_value('skillClass'), $skill->get_value('skillName'));
        }
    }
    if (count($skills) > 0) {
        $TPL["skills"] = page::select_options($skills, "");
    }
}
예제 #16
0
 function load_productSale_filter($_FORM)
 {
     $current_user =& singleton("current_user");
     // display the list of project name.
     $db = new db_alloc();
     if (!$_FORM['showAllProjects']) {
         $filter = "WHERE projectStatus = 'Current' ";
     }
     $query = prepare("SELECT projectID AS value, projectName AS label FROM project {$filter} ORDER by projectName");
     $rtn["show_project_options"] = page::select_options($query, $_FORM["projectID"], 70);
     // display the list of user name.
     if (have_entity_perm("productSale", PERM_READ, $current_user, false)) {
         $rtn["show_userID_options"] = page::select_options(person::get_username_list(), $_FORM["personID"]);
     } else {
         $person = new person();
         $person->set_id($current_user->get_id());
         $person->select();
         $person_array = array($current_user->get_id() => $person->get_name());
         $rtn["show_userID_options"] = page::select_options($person_array, $_FORM["personID"]);
     }
     // display a list of status
     $status_array = productSale::get_statii();
     unset($status_array["create"]);
     $rtn["show_status_options"] = page::select_options($status_array, $_FORM["status"]);
     // display the date from filter value
     $rtn["showAllProjects"] = $_FORM["showAllProjects"];
     $options["clientStatus"] = array("Current");
     $options["return"] = "dropdown_options";
     $ops = client::get_list($options);
     $ops = array_kv($ops, "clientID", "clientName");
     $rtn["clientOptions"] = page::select_options($ops, $_FORM["clientID"]);
     // Get
     $rtn["FORM"] = "FORM=" . urlencode(serialize($_FORM));
     return $rtn;
 }
예제 #17
0
function show_comments()
{
    global $timeSheetID;
    global $TPL;
    global $timeSheet;
    if ($timeSheetID) {
        $TPL["commentsR"] = comment::util_get_comments("timeSheet", $timeSheetID);
        $TPL["class_new_comment"] = "hidden";
        $TPL["allParties"] = $timeSheet->get_all_parties($timeSheet->get_value("projectID")) or $TPL["allParties"] = array();
        $TPL["entity"] = "timeSheet";
        $TPL["entityID"] = $timeSheet->get_id();
        $p = $timeSheet->get_foreign_object('project');
        $TPL["clientID"] = $p->get_value("clientID");
        $commentTemplate = new commentTemplate();
        $ops = $commentTemplate->get_assoc_array("commentTemplateID", "commentTemplateName", "", array("commentTemplateType" => "timeSheet"));
        $TPL["commentTemplateOptions"] = "<option value=\"\">Comment Templates</option>" . page::select_options($ops);
        $timeSheetPrintOptions = config::get_config_item("timeSheetPrintOptions");
        $timeSheetPrint = config::get_config_item("timeSheetPrint");
        $ops = array("" => "Format as...");
        foreach ($timeSheetPrint as $value) {
            $ops[$value] = $timeSheetPrintOptions[$value];
        }
        $TPL["attach_extra_files"] = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
        $TPL["attach_extra_files"] .= "Attach Time Sheet ";
        $TPL["attach_extra_files"] .= '<select name="attach_timeSheet">' . page::select_options($ops) . '</select><br>';
        include_template("../comment/templates/commentM.tpl");
    }
}
예제 #18
0
 function get_client_and_project_dropdowns_and_links($clientID = false, $projectID = false, $onlymine = false)
 {
     // This function returns dropdown lists and links for both client and
     // project. The two dropdown lists are linked, in that if you change the
     // client, then the project dropdown dynamically updates
     global $TPL;
     $project = new project();
     $project->set_id($projectID);
     $project->select();
     if (!$clientID) {
         $clientID = $project->get_value("clientID");
     }
     $client = new client();
     $client->set_id($clientID);
     $client->select();
     $options["clientStatus"] = "Current";
     $ops = client::get_list($options);
     $ops = array_kv($ops, "clientID", "clientName");
     $client->get_id() and $ops[$client->get_id()] = $client->get_value("clientName");
     $client_select = "<select id=\"clientID\" name=\"clientID\" onChange=\"makeAjaxRequest('" . $TPL["url_alloc_updateProjectListByClient"] . "clientID='+\$('#clientID').attr('value')+'&onlymine=" . sprintf("%d", $onlymine) . "','projectDropdown')\"><option></option>";
     $client_select .= page::select_options($ops, $clientID, 100) . "</select>";
     $client_link = $client->get_link();
     $project_select = '<div id="projectDropdown" style="display:inline">' . $project->get_dropdown_by_client($clientID, $onlymine) . '</div>';
     $project_link = $project->get_link();
     return array($client_select, $client_link, $project_select, $project_link);
 }
예제 #19
0
<?php

/*
 * Copyright (C) 2006-2011 Alex Lance, Clancy Malcolm, Cyber IT Solutions
 * Pty. Ltd.
 * 
 * This file is part of the allocPSA application <*****@*****.**>.
 * 
 * allocPSA is free software: you can redistribute it and/or modify it
 * 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(400000);
echo "<select id=\"projectID\" name=\"projectID\"><option></option>" . page::select_options(project::get_list_by_client($_GET["clientID"], $_GET["onlymine"])) . "</select>";
예제 #20
0
 public static function get_category_options($category = "")
 {
     has("task") and $category_options["search_tasks"] = "Search Tasks";
     has("project") and $category_options["search_projects"] = "Search Projects";
     has("time") and $category_options["search_time"] = "Search Time Sheets";
     has("client") and $category_options["search_clients"] = "Search Clients";
     has("comment") and $category_options["search_comment"] = "Search Comments";
     has("wiki") and $category_options["search_wiki"] = "Search Wiki";
     has("item") and $category_options["search_items"] = "Search Items";
     has("finance") and $category_options["search_expenseForm"] = "Search Expense Forms";
     return page::select_options($category_options, $category);
 }
예제 #21
0
/*
 * Copyright (C) 2006-2011 Alex Lance, Clancy Malcolm, Cyber IT Solutions
 * Pty. Ltd.
 * 
 * This file is part of the allocPSA application <*****@*****.**>.
 * 
 * allocPSA is free software: you can redistribute it and/or modify it
 * 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(400000);
$db = new db_alloc();
if ($_GET['current']) {
    $filter = " WHERE projectStatus = 'Current'";
}
$query = prepare("SELECT projectID AS value, projectName AS label FROM project {$filter} ORDER by projectName");
echo '<select name="projectID[]" multiple="true" style="width:100%">' . page::select_options($query, null, 70) . '</select>';
?>

예제 #22
0
$TPL["currencyOptions"] = page::select_options($currency_array, $transaction->get_value("currencyTypeID"));
$TPL["product"] = page::htmlentities($transaction->get_value("product"));
$TPL["statusOptions"] = page::select_options(array("pending" => "Pending", "rejected" => "Rejected", "approved" => "Approved"), $transaction->get_value("status"));
$transactionTypes = transaction::get_transactionTypes();
$TPL["transactionTypeOptions"] = page::select_options($transactionTypes, $transaction->get_value("transactionType"));
is_object($transaction) and $TPL["transactionTypeLink"] = $transaction->get_transaction_type_link();
$db = new db_alloc();
$tf = new tf();
$options = $tf->get_assoc_array("tfID", "tfName");
// Special cases for the current tfID and fromTfID
$options = add_tf($transaction->get_value("tfID"), $options, "tfIDWarning", " (warning: the TF <b>%s</b> is currently inactive)");
$options = add_tf($transaction->get_value("fromTfID"), $options, "fromTfIDWarning", " (warning: the TF <b>%s</b> is currently inactive)");
$TPL["tfIDOptions"] = page::select_options($options, $transaction->get_value("tfID"));
$TPL["fromTfIDOptions"] = page::select_options($options, $transaction->get_value("fromTfID"));
$q = "SELECT projectID as value, projectName as label FROM project WHERE projectStatus = 'Current' ORDER BY projectName";
$TPL["projectIDOptions"] = page::select_options($q, $transaction->get_value("projectID"));
$TPL["transactionModifiedUser"] = page::htmlentities(person::get_fullname($TPL["transactionModifiedUser"]));
$TPL["transactionCreatedUser"] = page::htmlentities(person::get_fullname($TPL["transactionCreatedUser"]));
$tf1 = new tf();
$tf1->set_id($TPL["tfID"]);
$tf1->select();
$TPL["tf_link"] = $tf1->get_link();
$tf2 = new tf();
$tf2->set_id($TPL["fromTfID"]);
$tf2->select();
$TPL["from_tf_link"] = $tf2->get_link();
$p = $transaction->get_foreign_object("project");
$TPL["project_link"] = $p->get_link();
$TPL["taxName"] = config::get_config_item("taxName");
if (is_object($current_user) && !$current_user->have_role("admin") && is_object($transaction) && in_array($transaction->get_value("status"), array("approved", "rejected"))) {
    $TPL["main_alloc_title"] = "View Transaction - " . APPLICATION_NAME;
예제 #23
0
    }
    $TPL["formTotal"] = page::money_print($rows);
}
if (is_object($expenseForm) && $current_user->have_role("admin") && !$expenseForm->get_invoice_link() && $expenseForm->get_value("expenseFormFinalised") && $expenseForm->get_value("seekClientReimbursement")) {
    $ops["invoiceStatus"] = "edit";
    $ops["clientID"] = $expenseForm->get_value("clientID");
    $invoice_list = invoice::get_list($ops);
    $invoice_list = array_kv($invoice_list, "invoiceID", array("invoiceNum", "invoiceName"));
    $q = prepare("SELECT * FROM invoiceItem WHERE expenseFormID = %d", $expenseForm->get_id());
    $db = new db_alloc();
    $db->query($q);
    $row = $db->row();
    $sel_invoice = $row["invoiceID"];
    $TPL["attach_to_invoice_button"] = "<select name=\"attach_to_invoiceID\">";
    $TPL["attach_to_invoice_button"] .= "<option value=\"create_new\">Create New Invoice</option>";
    $TPL["attach_to_invoice_button"] .= page::select_options($invoice_list, $sel_invoice) . "</select>";
    $TPL["attach_to_invoice_button"] .= "<input type=\"submit\" name=\"attach_transactions_to_invoice\" value=\"Add to Invoice\"> ";
    $TPL["invoice_label"] = "Invoice:";
}
if (is_object($expenseForm)) {
    $invoice_link = $expenseForm->get_invoice_link();
    if ($invoice_link) {
        $TPL["invoice_label"] = "Invoice:";
        $TPL["invoice_link"] = $invoice_link;
    }
}
$TPL["taxName"] = config::get_config_item("taxName");
$TPL["main_alloc_title"] = "Expense Form - " . APPLICATION_NAME;
if ($_GET["printVersion"]) {
    include_template("templates/expenseFormPrintableM.tpl");
} else {
예제 #24
0
파일: project.php 프로젝트: cjbayliss/alloc
function show_comments()
{
    global $projectID;
    global $TPL;
    global $project;
    $TPL["commentsR"] = comment::util_get_comments("project", $projectID);
    $TPL["commentsR"] and $TPL["class_new_comment"] = "hidden";
    $interestedPartyOptions = $project->get_all_parties();
    $interestedPartyOptions = interestedParty::get_interested_parties("project", $project->get_id(), $interestedPartyOptions);
    $TPL["allParties"] = $interestedPartyOptions or $TPL["allParties"] = array();
    $TPL["entity"] = "project";
    $TPL["entityID"] = $project->get_id();
    $TPL["clientID"] = $project->get_value("clientID");
    $commentTemplate = new commentTemplate();
    $ops = $commentTemplate->get_assoc_array("commentTemplateID", "commentTemplateName", "", array("commentTemplateType" => "project"));
    $TPL["commentTemplateOptions"] = "<option value=\"\">Comment Templates</option>" . page::select_options($ops);
    $ops = array("" => "Format as...", "pdf" => "PDF", "pdf_plus" => "PDF+", "html" => "HTML", "html_plus" => "HTML+");
    $TPL["attach_extra_files"] = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
    $TPL["attach_extra_files"] .= "Attach Task Report ";
    $TPL["attach_extra_files"] .= '<select name="attach_tasks">' . page::select_options($ops) . '</select><br>';
    include_template("../comment/templates/commentM.tpl");
}
예제 #25
0
        $skill->set_value('skillName', $_POST["other_new_skill_name"]);
        // description for now can be the same as the name
        $skill->set_value('skillDescription', $_POST["other_new_skill_name"]);
    } else {
        $failed = TRUE;
    }
    if ($failed == FALSE && $skill->skill_exists() == FALSE) {
        $skill->save();
    }
}
if ($_POST["delete_skill"]) {
    $skill = new skill();
    if ($_POST["new_skill_name"] != "") {
        $skill->set_id($_POST["new_skill_name"]);
        $skill->delete();
    }
}
$skill_classes = skill::get_skill_classes();
$skill_classes[""] = ">> OTHER >>";
$TPL["new_skill_classes"] = page::select_options($skill_classes, $_POST["skill_class"]);
$skills = skill::get_skills();
// if a skill class is selected and a skill that is not in that class is also selected, clear the skill as this is what the filter options will do
if ($skill_class && !in_array($skills[$_POST["skill"]], $skills)) {
    $_POST["skill"] = "";
}
$skills[""] = ">> NEW >>";
$TPL["new_skills"] = page::select_options($skills, $_POST["skill"]);
$TPL["main_alloc_title"] = "Edit Skills - " . APPLICATION_NAME;
if ($current_user->have_perm(PERM_PERSON_READ_MANAGEMENT)) {
    include_template("templates/personSkillAdd.tpl");
}
예제 #26
0
 function get_cc_list_select($projectID = "")
 {
     $interestedParty = array();
     $interestedPartyOptions = array();
     if (is_object($this)) {
         $interestedPartyOptions = $this->get_all_parties($projectID);
     } else {
         $project = new project($projectID);
         $interestedPartyOptions = $project->get_all_parties();
     }
     if (is_array($interestedPartyOptions)) {
         foreach ($interestedPartyOptions as $email => $info) {
             $name = $info["name"];
             $identifier = $info["identifier"];
             if ($info["role"] == "interested" && $info["selected"]) {
                 $interestedParty[] = $identifier;
             }
             if ($email) {
                 $name = trim($name);
                 $str = trim(page::htmlentities($name . " <" . $email . ">"));
                 $options[$identifier] = $str;
             }
         }
     }
     $str = "<select name=\"interestedParty[]\" multiple=\"true\">" . page::select_options($options, $interestedParty, 100, false) . "</select>";
     return $str;
 }
예제 #27
0
$tf->set_id($transactionRepeat->get_value("tfID"));
if ($tf->select() && !$tf->get_value("tfActive")) {
    $TPL["message_help"][] = "This expense is allocated to an inactive TF. It will not create transactions.";
}
$tf = new tf();
$tf->set_id($transactionRepeat->get_value("fromTfID"));
if ($tf->select() && !$tf->get_value("tfActive")) {
    $TPL["message_help"][] = "This expense is sourced from an inactive TF. It will not create transactions.";
}
$m = new meta("currencyType");
$currencyOps = $m->get_assoc_array("currencyTypeID", "currencyTypeID");
$TPL["currencyTypeOptions"] = page::select_options($currencyOps, $transactionRepeat->get_value("currencyTypeID"));
$TPL["tfOptions"] = page::select_options($q, $transactionRepeat->get_value("tfID"));
$TPL["fromTfOptions"] = page::select_options($q, $transactionRepeat->get_value("fromTfID"));
$TPL["basisOptions"] = page::select_options(array("weekly" => "weekly", "fortnightly" => "fortnightly", "monthly" => "monthly", "quarterly" => "quarterly", "yearly" => "yearly"), $transactionRepeat->get_value("paymentBasis"));
$TPL["transactionTypeOptions"] = page::select_options(transaction::get_transactionTypes(), $transactionRepeat->get_value("transactionType"));
if (is_object($transactionRepeat) && $transactionRepeat->get_id() && $current_user->have_role("admin")) {
    $TPL["adminButtons"] .= '
  <select name="changeTransactionStatus"><option value="">Transaction Status<option value="approved">Approve<option value="rejected">Reject<option value="pending">Pending</select>
  ';
}
if (is_object($transactionRepeat) && $transactionRepeat->get_id() && $transactionRepeat->get_value("status") == "pending") {
    $TPL["message_help"][] = "This Repeating Expense will only create Transactions once its status is Approved.";
} else {
    if (!$transactionRepeat->get_id()) {
        $TPL["message_help"][] = "Complete all the details and click the Save button to create an automatically Repeating Expense";
    }
}
$transactionRepeat->get_value("status") and $TPL["statusLabel"] = " - " . ucwords($transactionRepeat->get_value("status"));
$TPL["taxName"] = config::get_config_item("taxName");
$TPL["main_alloc_title"] = "Create Repeating Expense - " . APPLICATION_NAME;
예제 #28
0
 function load_timeSheet_filter($_FORM)
 {
     $current_user =& singleton("current_user");
     // display the list of project name.
     $db = new db_alloc();
     if (!$_FORM['showAllProjects']) {
         $filter = "WHERE projectStatus = 'Current' ";
     }
     $query = prepare("SELECT projectID AS value, projectName AS label FROM project {$filter} ORDER by projectName");
     $rtn["show_project_options"] = page::select_options($query, $_FORM["projectID"], 70);
     // display the list of user name.
     if (have_entity_perm("timeSheet", PERM_READ, $current_user, false)) {
         $rtn["show_userID_options"] = page::select_options(person::get_username_list(), $_FORM["personID"]);
     } else {
         $person = new person();
         $person->set_id($current_user->get_id());
         $person->select();
         $person_array = array($current_user->get_id() => $person->get_name());
         $rtn["show_userID_options"] = page::select_options($person_array, $_FORM["personID"]);
     }
     // display a list of status
     $status_array = timeSheet::get_timeSheet_statii();
     unset($status_array["create"]);
     if (!$_FORM["status"]) {
         $_FORM["status"][] = 'edit';
     }
     $rtn["show_status_options"] = page::select_options($status_array, $_FORM["status"]);
     // display the date from filter value
     $rtn["dateFrom"] = $_FORM["dateFrom"];
     $rtn["dateTo"] = $_FORM["dateTo"];
     $rtn["userID"] = $current_user->get_id();
     $rtn["showFinances"] = $_FORM["showFinances"];
     $rtn["showAllProjects"] = $_FORM["showAllProjects"];
     // Get
     $rtn["FORM"] = "FORM=" . urlencode(serialize($_FORM));
     return $rtn;
 }
예제 #29
0
    foreach ($ops as $v) {
        $table_name_options[$v] = $v;
    }
    $TPL["tableNameOptions"] = page::select_options($table_name_options, $permission->get_value("tableName"));
    include_template("templates/permissionTableM.tpl");
    exit;
}
if ($_POST["save"]) {
    $permission->set_value("actions", $actions);
    $permission->set_value("comment", rtrim($permission->get_value("comment")));
    $permission->save();
    alloc_redirect($TPL["url_alloc_permissionList"]);
} else {
    if ($_POST["delete"]) {
        $permission->delete();
        alloc_redirect($TPL["url_alloc_permissionList"]);
    }
}
// necessary
$permission->select();
$TPL["roleNameOptions"] = page::select_options(permission::get_roles(), $permission->get_value("roleName"));
$table_name = $_POST["tableName"] or $table_name = $permission->get_value("tableName");
$entity = new $table_name();
foreach ($entity->permissions as $value => $label) {
    if (($permission->get_value("actions") & $value) == $value) {
        $sel[] = $value;
    }
}
$TPL["actionOptions"] = page::select_options($entity->permissions, $sel);
$TPL["main_alloc_title"] = "Edit Permission - " . APPLICATION_NAME;
include_template("templates/permissionM.tpl");
예제 #30
0
파일: report.php 프로젝트: cjbayliss/alloc
}
$current_user =& singleton("current_user");
$TPL["mod"] = $_POST["mod"];
$TPL["do_step_2"] = $_POST["do_step_2"];
$TPL["do_step_3"] = $_POST["do_step_3"];
$modules = array();
$current_user->have_role("admin") and $modules["transaction"] = "Transactions";
$modules["invoice"] = "Invoices";
$modules["project"] = "Projects";
$modules["task"] = "Tasks";
$modules["time"] = "Time Sheets";
$modules["client"] = "Clients";
$modules["item"] = "Items";
$modules["person"] = "Users";
$modules["announcement"] = "Announcements";
$TPL["module_options"] = page::select_options($modules, $_POST["mod"]);
if ($_POST["do_step_2"]) {
    if (!is_array($fields)) {
        $fields = array();
    }
    $ignored_fields = array();
    $table_fields = array();
    $db_tables = array();
    if ($_POST["mod"] == "client") {
        $db_tables[] = "client";
        $db_tables[] = "clientContact";
        $db_tables[] = "comment";
        $query["join"] = " LEFT JOIN clientContact ON client.clientID = clientContact.clientID";
        $query["join"] .= " LEFT JOIN comment ON (client.clientID = comment.commentLinkID AND commentType = 'client')";
    }
    if ($_POST["mod"] == "project") {