function show_time_sheets_list_for_classes($template_name, $doAdmin = false)
{
    $current_user =& singleton("current_user");
    global $TPL;
    if ($doAdmin) {
        $db = get_pending_admin_timesheet_db();
    } else {
        $db = get_pending_timesheet_db();
    }
    $people =& get_cached_table("person");
    while ($db->next_record()) {
        $timeSheet = new timeSheet();
        $timeSheet->read_db_record($db);
        $timeSheet->set_values();
        unset($date);
        if ($timeSheet->get_value("status") == "manager") {
            $date = $timeSheet->get_value("dateSubmittedToManager");
        } else {
            if ($timeSheet->get_value("status") == "admin") {
                $date = $timeSheet->get_value("dateSubmittedToAdmin");
            }
        }
        unset($TPL["warning"]);
        // older than $current_user->prefs["timeSheetDaysWarn"] days
        if ($date && imp($current_user->prefs["timeSheetDaysWarn"]) && (mktime() - format_date("U", $date)) / 60 / 60 / 24 > $current_user->prefs["timeSheetDaysWarn"]) {
            $TPL["warning"] = page::help("This time sheet was submitted to you over " . $current_user->prefs["timeSheetDaysWarn"] . " days ago.", page::warn());
        }
        $TPL["date"] = "<a href=\"" . $TPL["url_alloc_timeSheet"] . "timeSheetID=" . $timeSheet->get_id() . "\">" . $date . "</a>";
        $TPL["user"] = $people[$timeSheet->get_value("personID")]["name"];
        $TPL["projectName"] = $db->f("projectName");
        include_template("../time/templates/" . $template_name);
    }
}
Example #2
0
function show_filter($template)
{
    global $TPL;
    show_skill_classes();
    show_skills();
    include_template($template);
}
Example #3
0
function show_overdue($template_name)
{
    global $db;
    global $TPL;
    $current_user =& singleton("current_user");
    $db = new db_alloc();
    $temp = mktime(0, 0, 0, date("m"), date("d"), date("Y"));
    $today = date("Y", $temp) . "-" . date("m", $temp) . "-" . date("d", $temp);
    $q = prepare("SELECT itemName,itemType,item.itemID,dateBorrowed,dateToBeReturned,loan.personID \n                  FROM loan,item \n                 WHERE dateToBeReturned < '%s' \n\t\t\t\t\t         AND dateReturned = '0000-00-00' \n\t\t\t\t\t         AND item.itemID = loan.itemID\n               ", $today);
    if (!have_entity_perm("loan", PERM_READ, $current_user, false)) {
        $q .= prepare("AND loan.personID = %d", $current_user->get_id());
    }
    $db->query($q);
    while ($db->next_record()) {
        $i++;
        $item = new item();
        $loan = new loan();
        $item->read_db_record($db);
        $loan->read_db_record($db);
        $item->set_values();
        $loan->set_values();
        $person = new person();
        $person->set_id($loan->get_value("personID"));
        $person->select();
        $TPL["person"] = $person->get_name();
        $TPL["overdue"] = "<a href=\"" . $TPL["url_alloc_item"] . "itemID=" . $item->get_id() . "&return=true\">Overdue!</a>";
        include_template($template_name);
    }
}
Example #4
0
 function get_list_html($rows = array(), $ops = array())
 {
     global $TPL;
     $TPL["wikiListRows"] = $rows;
     $TPL["_FORM"] = $ops;
     include_template(dirname(__FILE__) . "/../templates/wikiListS.tpl");
 }
function show_expenseFormList($template_name)
{
    global $db;
    global $TPL;
    global $transactionRepeat;
    $current_user =& singleton("current_user");
    $db = new db_alloc();
    $transactionRepeat = new transactionRepeat();
    if (!$_GET["tfID"] && !$current_user->have_role("admin")) {
        $tfIDs = $current_user->get_tfIDs();
        $tfIDs and $sql = prepare("WHERE tfID in (%s)", $tfIDs);
    } else {
        if ($_GET["tfID"]) {
            $sql = prepare("WHERE tfID = %d", $_GET["tfID"]);
        }
    }
    $db->query("select * FROM transactionRepeat " . $sql);
    while ($db->next_record()) {
        $i++;
        $transactionRepeat->read_db_record($db);
        $transactionRepeat->set_values();
        $TPL["tfName"] = tf::get_name($transactionRepeat->get_value("tfID"));
        $TPL["fromTfName"] = tf::get_name($transactionRepeat->get_value("fromTfID"));
        include_template($template_name);
    }
    $TPL["tfID"] = $tfID;
}
Example #6
0
function show_timeSheetItems($template_name)
{
    global $date_to_view;
    $current_user =& singleton("current_user");
    global $TPL;
    $query = prepare("SELECT * \n                      FROM timeSheetItem \n                           LEFT JOIN timeSheet ON timeSheetItem.timeSheetID = timeSheet.timeSheetID\n                           LEFT JOIN project ON timeSheet.projectID = project.projectID\n                      WHERE dateTimeSheetItem='%s'\n                            AND timeSheet.personID=%d", date("Y-m-d", $date_to_view), $current_user->get_id());
    $db = new db_alloc();
    $db->query($query);
    while ($db->next_record()) {
        $timeSheetItem = new timeSheetItem();
        $timeSheetItem->read_db_record($db);
        $timeSheetItem->set_values();
        if ($timeSheetItem->get_value("unit") == "Hour") {
            $TPL["daily_hours_total"] += $timeSheetItem->get_value("timeSheetItemDuration");
        }
        $project = new project();
        $project->read_db_record($db);
        $project->set_values();
        if ($project->get_value("projectShortName")) {
            $TPL["item_description"] = $project->get_value("projectShortName");
        } else {
            $TPL["item_description"] = $project->get_value("projectName");
        }
        include_template($template_name);
    }
}
Example #7
0
function show_users_stats($template)
{
    global $TPL;
    global $db;
    $stats = new stats();
    $projects = $stats->project_stats();
    $tasks = $stats->task_stats();
    $comments = $stats->comment_stats();
    $persons = array();
    $query = "SELECT * FROM person ORDER BY username";
    $db->query($query);
    while ($db->next_record()) {
        $person = new person();
        $person->read_db_record($db);
        array_push($persons, $person->get_id());
    }
    usort($persons, "compare");
    for ($i = 0; $i < count($persons); $i++) {
        $person = new person();
        $person->set_id($persons[$i]);
        $person->select();
        $TPL["user_username"] = $person->get_value("username");
        $TPL["user_projects_current"] = $projects["current"][$person->get_id()] + 0;
        $TPL["user_projects_total"] = $projects["current"][$person->get_id()] + $projects["archived"][$person->get_id()];
        $TPL["user_tasks_current"] = $tasks["current"][$person->get_id()] + 0;
        $TPL["user_tasks_total"] = $tasks["current"][$person->get_id()] + $tasks["completed"][$person->get_id()];
        $TPL["user_comments_total"] = $comments["total"][$person->get_id()] + 0;
        $TPL["user_graph"] = "<a href=\"" . $TPL["url_alloc_statsImage"] . "id=" . $person->get_id() . "&width=640&multiplier=8&labels=true\">";
        $TPL["user_graph"] .= "<img alt=\"User graph\" src=\"" . $TPL["url_alloc_statsImage"] . "id=" . $person->get_id() . "&width=400&multiplier=2\"></a>";
        if ($TPL["user_projects_total"] + $TPL["user_tasks_total"] + $TPL["user_comments_total"] > 0) {
            $TPL["odd_even"] = $TPL["odd_even"] == "odd" ? "even" : "odd";
            include_template($template);
        }
    }
}
Example #8
0
function show_filter()
{
    global $TPL;
    global $defaults;
    $arr = timeSheetGraph::load_filter($defaults);
    is_array($arr) and $TPL = array_merge($TPL, $arr);
    include_template("templates/timeSheetGraphFilterS.tpl");
}
Example #9
0
function show_new_person($template)
{
    global $TPL;
    $TPL["person_buttons"] = '
        <button type="submit" name="person_save" value="1" class="save_button">Add<i class="icon-plus-sign"></i></button>';
    $tfPerson = new tfPerson();
    $tfPerson->set_values("person_");
    include_template($template);
}
Example #10
0
 function show()
 {
     global $TPL;
     if ($this->template) {
         //$TPL["this"] = $this;
         $TPL[$this->module] = $this;
         include_template($this->get_template_dir() . $this->template);
     }
 }
Example #11
0
function show_filter()
{
    global $TPL;
    global $defaults;
    $_FORM = transaction::load_form_data($defaults);
    $arr = transaction::load_transaction_filter($_FORM);
    is_array($arr) and $TPL = array_merge($TPL, $arr);
    include_template("templates/searchTransactionFilterS.tpl");
}
Example #12
0
function show_filter()
{
    global $TPL;
    global $defaults;
    $_FORM = timeSheet::load_form_data($defaults);
    $arr = timeSheet::load_timeSheet_filter($_FORM);
    is_array($arr) and $TPL = array_merge($TPL, $arr);
    include_template("templates/timeSheetListFilterS.tpl");
}
Example #13
0
function show_filter()
{
    global $TPL;
    global $defaults;
    $_FORM = person::load_form_data($defaults);
    $arr = person::load_person_filter($_FORM);
    is_array($arr) and $TPL = array_merge($TPL, $arr);
    include_template("templates/personListFilterS.tpl");
}
Example #14
0
/**
 * Locates and loads a theme template.
 * 
 * Replacement for WordPress function get_template_part()
 * 
 * @see get_template_part()
 * 
 * @param string $slug Template slug.
 * @param string $name [Optional] Optional template name.
 * @return void
 */
function template_part($slug, $name = null)
{
    $slug = App::instance()->get('theme')->getTemplatePartPath($slug);
    do_action("get_template_part_{$slug}", $slug, $name);
    $templates = array();
    if (!empty($name)) {
        $templates[] = "{$slug}-{$name}.php";
    }
    $templates[] = "{$slug}.php";
    include_template(locate_template($templates));
}
Example #15
0
function show_productCost_new($template, $percent = false)
{
    global $TPL;
    $t = new meta("currencyType");
    $currency_array = $t->get_assoc_array("currencyTypeID", "currencyTypeID");
    $productCost = new productCost();
    $productCost->set_values();
    // wipe clean
    $TPL["currencyOptions"] = page::select_options($currency_array, $productCost->get_value("currencyTypeID"));
    $TPL["taxOptions"] = page::select_options(array("" => "Exempt", 1 => "Included", 0 => "Excluded"), "1");
    $TPL["display"] = "display:none";
    include_template($template);
}
Example #16
0
function show_items($template_name)
{
    global $TPL;
    global $db;
    global $db2;
    $current_user =& singleton("current_user");
    $today = date("Y") . "-" . date("m") . "-" . date("d");
    $dbUsername = new db_alloc();
    $db = new db_alloc();
    $db2 = new db_alloc();
    $db->query("select * from item order by itemName");
    while ($db->next_record()) {
        $i++;
        $item = new item();
        $item->read_db_record($db);
        $db2->query("select * from loan where itemID=" . $item->get_id() . " and dateReturned='0000-00-00'");
        $db2->next_record();
        $loan = new loan();
        $loan->read_db_record($db2);
        $item->set_values();
        // you need to have this repeated here for the a href bit below.
        if ($loan->get_value("dateReturned") == "0000-00-00") {
            if ($loan->have_perm(PERM_READ_WRITE)) {
                // if item is overdue
                if ($loan->get_value("dateToBeReturned") < $today) {
                    $ret = "Return Now!";
                } else {
                    $ret = "Return";
                }
                $TPL["itemAction"] = "<td><a href=\"" . $TPL["url_alloc_item"] . "itemID=" . $TPL["itemID"] . "&return=true\">{$ret}</a></td>";
            } else {
                // if you don't have permission to borrow or return item.
                $TPL["itemAction"] = "<td>&nbsp;</td>";
            }
            $TPL["status"] = "Due " . $loan->get_value("dateToBeReturned");
            $dbUsername->query("select username from person where personID=" . $loan->get_value("personID"));
            $dbUsername->next_record();
            $TPL["person"] = "from " . $dbUsername->f("username");
        } else {
            // if the item is available
            $TPL["status"] = "Available";
            $TPL["person"] = "";
            $TPL["itemAction"] = "<td><a href=\"" . $TPL["url_alloc_item"] . "itemID=" . $TPL["itemID"] . "&borrow=true\">Borrow</a></td>";
            $TPL["dueBack"] = "";
        }
        $loan->set_values();
        $item->set_values();
        include_template($template_name);
    }
}
Example #17
0
function show_filter()
{
    global $TPL;
    global $defaults;
    $_FORM = invoice::load_form_data($defaults);
    $arr = invoice::load_invoice_filter($_FORM);
    is_array($arr) and $TPL = array_merge($TPL, $arr);
    $payment_statii = invoice::get_invoice_statii_payment();
    foreach ($payment_statii as $payment_status => $label) {
        $summary .= "\n" . $nbsp . invoice::get_invoice_statii_payment_image($payment_status) . " " . $label;
        $nbsp = "&nbsp;&nbsp;";
    }
    $TPL["status_legend"] = $summary;
    include_template("templates/invoiceListFilterS.tpl");
}
Example #18
0
function show_people($template_name)
{
    global $person_query;
    global $project;
    global $TPL;
    $db = new db_alloc();
    $db->query($person_query);
    while ($db->next_record()) {
        $person = new person();
        $person->read_db_record($db);
        $person->set_values("person_");
        $TPL["graphTitle"] = urlencode($person->get_name());
        include_template($template_name);
    }
}
Example #19
0
function show_commentTemplate($template_name)
{
    global $TPL;
    // Run query and loop through the records
    $db = new db_alloc();
    $query = "SELECT * FROM commentTemplate ORDER BY commentTemplateType, commentTemplateName";
    $db->query($query);
    while ($db->next_record()) {
        $commentTemplate = new commentTemplate();
        $commentTemplate->read_db_record($db);
        $commentTemplate->set_values();
        $TPL["odd_even"] = $TPL["odd_even"] == "even" ? "odd" : "even";
        include_template($template_name);
    }
}
Example #20
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);
}
Example #21
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);
    }
}
Example #22
0
function show_announcements($template_name)
{
    global $TPL;
    $people =& get_cached_table("person");
    $query = "SELECT announcement.* \n              FROM announcement \n              ORDER BY displayFromDate DESC";
    $db = new db_alloc();
    $db->query($query);
    while ($db->next_record()) {
        $announcement = new announcement();
        $announcement->read_db_record($db);
        $announcement->set_values();
        $TPL["personName"] = $people[$announcement->get_value("personID")]["name"];
        $TPL["odd_even"] = $TPL["odd_even"] == "odd" ? "even" : "odd";
        include_template($template_name);
    }
}
 function show_announcements($template_name)
 {
     $current_user =& singleton("current_user");
     global $TPL;
     $query = "SELECT *\n                FROM announcement \n               WHERE displayFromDate <= CURDATE() AND displayToDate >= CURDATE()\n            ORDER BY displayFromDate desc";
     $db = new db_alloc();
     $db->query($query);
     while ($db->next_record()) {
         $announcement = new announcement();
         $announcement->read_db_record($db);
         $announcement->set_tpl_values();
         $person = $announcement->get_foreign_object("person");
         $TPL["personName"] = $person->get_name();
         include_template($this->get_template_dir() . $template_name);
     }
 }
Example #24
0
function show_home_items($width, $home_items)
{
    global $TPL;
    $items = array();
    foreach ($home_items as $item) {
        $i = new $item();
        $items[] = $i;
    }
    uasort($items, "sort_home_items");
    foreach ((array) $items as $item) {
        if ($item->width == $width && $item->visible()) {
            $TPL["item"] = $item;
            if ($item->render()) {
                include_template("templates/homeItemS.tpl");
            }
        }
    }
}
Example #25
0
function show_all_exp($template)
{
    global $TPL;
    global $expenseForm;
    global $db;
    global $transaction_to_edit;
    if ($expenseForm->get_id()) {
        if ($_POST["transactionID"] && ($_POST["edit"] || is_object($transaction_to_edit) && $transaction_to_edit->get_id())) {
            // if edit is clicked OR if we've rejected changes made to something so are still editing it
            $query = prepare("SELECT * FROM transaction WHERE expenseFormID=%d AND transactionID<>%d ORDER BY transactionID DESC", $expenseForm->get_id(), $_POST["transactionID"]);
        } else {
            $query = prepare("SELECT * FROM transaction WHERE expenseFormID=%d ORDER BY transactionID DESC", $expenseForm->get_id());
        }
        $db->query($query);
        while ($db->next_record()) {
            $transaction = new transaction();
            $transaction->read_db_record($db);
            $transaction->set_values();
            $transaction->get_value("quantity") and $TPL["amount"] = $transaction->get_value("amount") / $transaction->get_value("quantity");
            $TPL["lineTotal"] = $TPL["amount"] * $transaction->get_value("quantity");
            $tf = new tf();
            $tf->set_id($transaction->get_value("fromTfID"));
            $tf->select();
            $TPL["fromTfIDLink"] = $tf->get_link();
            $tf = new tf();
            $tf->set_id($transaction->get_value("tfID"));
            $tf->select();
            $TPL["tfIDLink"] = $tf->get_link();
            $projectID = $transaction->get_value("projectID");
            if ($projectID) {
                $project = new project();
                $project->set_id($transaction->get_value("projectID"));
                $project->select();
                $TPL["projectName"] = $project->get_value("projectName");
            }
            if ($transaction->get_value("fromTfID") == config::get_config_item("expenseFormTfID")) {
                $TPL['expense_class'] = "loud";
            } else {
                $TPL['expense_class'] = "";
            }
            include_template($template);
        }
    }
}
Example #26
0
function show_permission_list($template_name)
{
    global $TPL;
    $roles = permission::get_roles();
    if ($_REQUEST["submit"] || $_REQUEST["filter"] != "") {
        $where = " where tableName like '%" . db_esc($_REQUEST["filter"]) . "%' ";
        // TODO: Add filtering to permission list
    }
    $db = new db_alloc();
    $db->query("SELECT * FROM permission {$where} ORDER BY tableName, sortKey");
    while ($db->next_record()) {
        $permission = new permission();
        $permission->read_db_record($db);
        $permission->set_values();
        $TPL["actions"] = $permission->describe_actions();
        $TPL["odd_even"] = $TPL["odd_even"] == "odd" ? "even" : "odd";
        $TPL["roleName"] = $roles[$TPL["roleName"]];
        include_template($template_name);
    }
}
Example #27
0
function show_projects($template_name)
{
    global $TPL;
    global $default;
    $_FORM = task::load_form_data($defaults);
    $arr = task::load_task_filter($_FORM);
    is_array($arr) and $TPL = array_merge($TPL, $arr);
    if (is_array($_FORM["projectID"])) {
        $projectIDs = $_FORM["projectID"];
        foreach ($projectIDs as $projectID) {
            $project = new project();
            $project->set_id($projectID);
            $project->select();
            $_FORM["projectID"] = array($projectID);
            $TPL["graphTitle"] = urlencode($project->get_value("projectName"));
            $arr = task::load_task_filter($_FORM);
            is_array($arr) and $TPL = array_merge($TPL, $arr);
            include_template($template_name);
        }
    }
}
Example #28
0
 /**
  * Loads a specified page
  *
  * @param null $page_name
  */
 public function index($page_name = NULL)
 {
     // Setting data to be passed to view
     $data['list_of_pages'] = $this->pages_model->get_all_pages();
     $data['list_of_books'] = $this->books_model->get_all_books();
     $data['catalog_info'] = $this->books_model->get_catalog_info();
     // If no page is provided the default page is set to the first page in the database and the title is different
     if ($page_name === NULL) {
         $data['selected_page'] = $data['list_of_pages'][0];
         $data['selected_page']['title'] = "Видавництво \"Юридична думка\"";
     } else {
         $data['selected_page'] = $this->pages_model->get_page($page_name);
     }
     // loading view
     // Special case for price_list_print
     if ($page_name === "price_list_print") {
         $this->load->view('price_list_print', $data);
     } else {
         $this->load->view('layouts/header', $data);
         // If the content contains a template ({template_name}) loads it. Otherwise loads index
         NULL !== include_template($data['selected_page']["content"]) ? $this->load->view(include_template($data['selected_page']["content"]), $data) : $this->load->view('index', $data);
         $this->load->view('layouts/footer');
     }
 }
							<div style="padding: 10px 0 10px 0; display: none;" id="step_<?php 
    echo $step->getID();
    ?>
_transition_delete_indicator"><span style="float: right;"><?php 
    echo image_tag('spinning_16.gif');
    ?>
</span>&nbsp;<?php 
    echo __('Please wait');
    ?>
</div>
						</div>
					</form>
				</div>
			</div>
			<?php 
    include_template('configuration/workflowaddtransition', array('step' => $step));
    ?>
			<div class="rounded_box shadowed white" id="step_<?php 
    echo $step->getID();
    ?>
_delete" style="width: 720px; position: absolute; padding: 5px; margin: 5px; display: none;">
				<div class="header"><?php 
    echo __('Completely delete step "%step_name%"', array('%step_name%' => $step->getName()));
    ?>
</div>
				<div class="content">
					<?php 
    echo __('Are you sure you want to completely delete this step? This action cannot be reverted.');
    ?>
					<form accept-charset="<?php 
    echo TBGContext::getI18n()->getCharset();
Example #30
0
        </li>
       </ul>

       <div id="comment" class="shoe_comments">
       </div>
      </div>
     </div>
    </div>

   </div>
  </form>
 </div>
 <?php
 if ($$class->po_type == 'CONTRACT') {
  echo '</div></div>  </div>     <div id="content_bottom"></div>   </div>   <div id="content_right_right"></div>  </div> </div>';
  include_template('footer.inc');
  return;
 }
 ?>
 <div id="form_line" class="form_line"><span class="heading"><?php echo gettext('PO Lines & Shipments') ?></span>
  <form action=""  method="post" id="po_line"  name="po_line">
   <div id="tabsLine">
    <ul class="tabMain">
     <li><a href="#tabsLine-1"><?php echo gettext('Basic') ?></a></li>
     <li><a href="#tabsLine-2"><?php echo gettext('Finance') ?> </a></li>
     <li><a href="#tabsLine-3"><?php echo gettext('Agreement Details') ?> </a></li>
     <li><a href="#tabsLine-4"><?php echo gettext('Other Info') ?> </a></li>
    </ul>
    <div class="tabContainer">
     <div id="tabsLine-1" class="tabContent">
      <table class="form_line_data_table">