Exemple #1
0
?>
"><?php 
echo $this->aticketcount;
?>
, View listing</a></p></div>
        </div>
    </div>
</div>

    <div class="row">
        <?php 
if (Session::getRole()) {
    if (true) {
        $modules = $_SESSION['emp_role_module'];
        foreach ($modules as $module) {
            $thisModule = Modules::find_by_module($module);
            echo "\n            <div class='large-3  columns'><a href='" . $uri->link($module . '/' . $thisModule->link) . "'><div class='" . $thisModule->css_class . "'>\n             {$thisModule->description}</div></a>\n            </div>";
        }
    } else {
        $this->view->render("access/restricted");
    }
}
?>




    </div>


 /**
  * 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");
     }
 }
 public function sche()
 {
     $worksheetlisting = "";
     $this->loadModel("Itdepartment");
     $datum = $this->model->getWorkSheetList("", "Itdepartment");
     $this->view->worksheets = $datum['worksheet'];
     $uri = new Url("");
     $worksheetlisting .= "<table  width='100%'>\n<thead><tr>\n\t<th>S/N</th><th>Prod ID</th><th>Status</th><th>Emp ID</th><th>Issue</th><th>Date Generated </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>{$worksheet->prod_id}</td><td>{$worksheet->status} </td><td>{$worksheet->cse_emp_id}</td><td>{$worksheet->problem}</td><td>{$worksheet->sheet_date}</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) && $emodule->module == "support" && $worksheet->status == "Open") {
                         $worksheetlisting .= "<td><a href='" . $uri->link("itdepartment/tasksupport/" . $worksheet->id . "") . "'>Allocate Resource</a></td>";
                     } elseif (in_array("Modify", $grant) && $worksheet->status == "Open") {
                         $worksheetlisting .= "<td><a href='" . $uri->link("itdepartment/taskedit/" . $worksheet->id . "") . "'>Edit</a></td>";
                     } elseif ($session->employee_role == '10') {
                         $worksheetlisting .= "<td><a href='" . $uri->link("itdepartment/taskedit/" . $worksheet->id . "") . "'>Edit</a></td>";
                     } else {
                         $worksheetlisting .= "<td></td>";
                     }
                     if (in_array("View", $grant)) {
                         $worksheetlisting .= "<td><a href='" . $uri->link("itdepartment/worksheetdetail/" . $worksheet->id . "") . "'>View Detail</a></td>";
                     } else {
                         $worksheetlisting .= "<td></td>";
                     }
                     if (in_array("Delete", $grant)) {
                         $worksheetlisting .= "<td><a href='" . $uri->link("employees/doDelete/" . $emp->id . "") . "'>Delete</a></td>";
                     } else {
                         $worksheetlisting .= "<td></td>";
                     }
                 }
             }
             $worksheetlisting .= "</tr>";
             $x++;
         }
     } else {
         $worksheetlisting .= "<tr><td colspan='7'>No record to display</td></tr>";
     }
     $worksheetlisting .= "</tbody>\n</table>";
     return $worksheetlisting;
 }