Beispiel #1
0
 /**
  * this section is
  * needed to list out worksheets
  */
 public function worksheetlist()
 {
     $worksheetlisting = "";
     $this->loadModel("Support");
     $datum = $this->model->getWorkSheetList("", "support");
     $this->view->worksheets = $datum['worksheet'];
     $uri = new Url("");
     $worksheetlisting .= "<div class='row'><div class='large-12 columns'>" . $datum['mypagin'];
     $worksheetlisting .= "</div></div><div class='row'><div class='large-12 columns'><table  width='100%'>\n<thead><tr>\n\t<th>S/N</th><th>Product/Machine</th><th>Issue</th><th>Status</th><th>Technician</th><th>Date Generated </th><th>Expenses</th><th></th><th></th><th></th>\n</tr>\n</thead>\n<tbody>";
     if ($this->view->worksheets) {
         $x = 1;
         foreach ($this->view->worksheets as $worksheet) {
             $worksheetlisting .= "<tr>\n    \t<td>{$x}</td><td>";
             $cprod = $this->model->getClientProdByID($worksheet->prod_id);
             $worksheetlisting .= $cprod->prod_name . " " . $cprod->install_address . " " . $cprod->install_city;
             //print_r($worksheet->cse_emp_id);
             $worksheetlisting .= "</td><td>{$worksheet->problem}</td><td>{$worksheet->status} </td><td>";
             $emp = $this->model->getEmployee((int) preg_replace('#[^0-9]#i', '', $worksheet->cse_emp_id));
             //print_r($cprod);
             $worksheetlisting .= $emp->emp_fname . " " . $emp->emp_lname;
             $worksheetlisting .= "</td><td>" . date_format(date_create($worksheet->sheet_date), "M d Y H:i:s") . "</td><td>" . Worksheet::getExpensesById($worksheet->id) . "</td>";
             /**
              * section to set grant and\
              * previledge
              */
             global $session;
             foreach ($session->employee_role as $erole) {
                 $emodule = Modules::find_by_module($erole->module);
                 $grant = array();
                 $grant = explode(",", $erole->access);
                 if ($erole->module == "worksheetform") {
                     if (in_array("Modify", $grant)) {
                         $worksheetlisting .= "<td><a href='" . $uri->link("support/tasksupport/" . $worksheet->id . "") . "'>Allocate Resource</a></td>";
                     } elseif (in_array("Modify", $grant)) {
                         $worksheetlisting .= "<td><a href='" . $uri->link("support/worksheetedit/" . $worksheet->id . "") . "'>Edit</a></td>";
                     } elseif ($session->employee_role == '10') {
                         $worksheetlisting .= "<td><a href='" . $uri->link("support/worksheetedit/" . $worksheet->id . "") . "'>Edit</a></td>";
                     } else {
                         $worksheetlisting .= "<td></td>";
                     }
                     if (in_array("View", $grant)) {
                         $worksheetlisting .= "<td><a href='" . $uri->link("support/worksheetdetail/" . $worksheet->id . "") . "'>View Detail</a></td>";
                     } else {
                         $worksheetlisting .= "<td></td>";
                     }
                     if (in_array("Delete", $grant)) {
                         $worksheetlisting .= "<td></td>";
                     } else {
                         $worksheetlisting .= "<td></td>";
                     }
                 }
             }
             $worksheetlisting .= "</tr>";
             $x++;
         }
     } else {
         $worksheetlisting .= "<tr><td colspan='9'>No record to display</td></tr>";
     }
     $worksheetlisting .= "</tbody>\n</table></div></div><div class='row'><div class='large-12 columns'>";
     $worksheetlisting .= $datum['mypagin'] . "</div><p>&nbsp;</p></div>";
     $this->view->myvends = $worksheetlisting;
     if (isset($_POST['clientid'])) {
         echo $worksheetlisting;
     } elseif (isset($_POST['rec'])) {
         echo $worksheetlisting;
     } else {
         $this->view->render("support/worksheetlist");
     }
 }
Beispiel #2
0
</tr>
			</thead>
			<tbody>
                <?php 
if ($this->worksheet) {
    $x = 1;
    foreach ($this->worksheet as $worksheet) {
        $worksheetlisting .= "<tr>\n    \t<td>{$x}</td><td>";
        $cprod = Cproduct::find_by_id($worksheet->prod_id);
        $worksheetlisting .= $cprod->prod_name . " " . $cprod->install_address . " " . $cprod->install_city;
        //print_r($worksheet->cse_emp_id);
        $worksheetlisting .= "</td><td>{$worksheet->problem}</td><td>{$worksheet->status} </td><td>";
        $emp = Employee::find_by_id((int) preg_replace('#[^0-9]#i', '', $worksheet->cse_emp_id));
        //print_r($cprod);
        $worksheetlisting .= $emp->emp_fname . " " . $emp->emp_lname;
        $worksheetlisting .= "</td><td>" . date_format(new DateTime($worksheet->sheet_date), "M d Y H:i:s") . "</td><td>" . Worksheet::getExpensesById($worksheet->id) . "</td>";
        /**
         * section to set grant and\
         * previledge
         */
        global $session;
        $worksheetlisting .= "";
        $worksheetlisting .= "</tr>";
        $x++;
    }
} else {
    $worksheetlisting .= "<tr><td colspan='9'>No record to display</td></tr>";
}
echo $worksheetlisting;
?>