Example #1
0
 public function index($mid = 1)
 {
     $vendorlist = "";
     if (empty($mid)) {
         redirect_to($this->uri->link("error/index"));
         exit;
     }
     $this->loadModel("Vendors");
     $datum = $this->model->getList("", "Vendors");
     $this->view->myvendors = $datum['vendors'];
     $uri = new Url("");
     $vendorlist .= "<table  width='100%'>\n<thead><tr>\n\t<th>S/N</th><th>Vendor ID</th><th>Vendor Name </th><th>Email </th><th>Telephone </th><th>Date Modified </th><th></th><th></th>\n</tr>\n</thead>\n<tbody>";
     if ($this->view->myvendors) {
         $x = 1;
         foreach ($this->view->myvendors as $vendor) {
             $vendorlist .= "<tr>\n    \t<td>{$x}</td><td>{$vendor->vend_id}</td><td>{$vendor->vend_name} </td><td>{$vendor->vend_email}</td><td>{$vendor->vend_phone}</td><td>{$vendor->vend_datemodified}</td><td><a href='" . $uri->link("vendors/edit/" . $vendor->id . "") . "'>Edit</a></td><td><a href='" . $uri->link("vendors/doDelete/" . $vendor->id . "") . "'>Delete</a></td>\n    </tr>";
             $x++;
         }
     } else {
         $vendorlist .= "<tr><td colspan='7'>No record to display</td></tr>";
     }
     $vendorlist .= "</tbody>\n</table>";
     $this->view->myvends = $vendorlist;
     if (Session::getRole()) {
         if (in_array(strtolower(get_class($this)), $_SESSION['emp_role_module'])) {
             $this->view->render("vendors/index");
         } else {
             $this->view->render("access/restricted");
         }
     }
 }
Example #2
0
 public function index()
 {
     @$this->loadModel("Role");
     $this->view->myrole = $this->model->getList();
     if (Session::getRole()) {
         if (in_array(strtolower(get_class($this)), $_SESSION['emp_role_module'])) {
             $this->view->render("role/index");
         } else {
             $this->view->render("access/restricted");
         }
     }
 }
Example #3
0
 public function index($mid = 1)
 {
     $emplist = "";
     if (empty($mid)) {
         redirect_to($this->uri->link("error/index"));
         exit;
     }
     $this->loadModel("Employees");
     $datum = $this->model->getList("", "Employees");
     $this->view->myemployee = $datum['myemployee'];
     $datumo = $this->model->getData();
     //get general array data
     $this->view->state = $datumo['state'];
     //get state of origin from array
     // $this->view->employee    =   $this->model->getById($id);
     $this->view->role = $datumo['role'];
     $this->view->depts = $datumo['departs'];
     $uri = new Url("");
     $emplist .= "<div class='row'><div class='large-12 columns'>";
     $emplist .= "</div></div><div class='row'><div class='large-12 columns'><table id='dt_basic'  width='100%'>\n<thead><tr>\n\t<th>Emp ID</th><th>Fullname </th><th>Department </th><th>Post </th><th>Date Employed </th><th></th><th></th>\n</tr>\n</thead>\n<tbody>";
     if ($this->view->myemployee) {
         $x = 1;
         foreach ($this->view->myemployee as $emp) {
             $emplist .= "<tr>\n    \t<td>{$emp->emp_id}</td><td>{$emp->emp_fname} {$emp->emp_mname} " . strtoupper("{$emp->emp_lname}") . "</td><td>";
             if (!empty($emp->emp_dept)) {
                 if ($this->model->findDepartment($emp->emp_dept)) {
                     $empDept = $this->model->findDepartment($emp->emp_dept);
                     $emplist .= $empDept->dept_name;
                 }
             }
             $emplist .= "</td><td>";
             if (!empty($emp->emp_post)) {
                 if ($this->model->findRole($emp->emp_post)) {
                     $empRole = $this->model->findRole($emp->emp_post);
                     $emplist .= $empRole->role_name;
                 }
             }
             $emplist .= "</td><td>{$emp->emp_date_employed}</td>";
             /**
              * section to set grant and\
              * previledge
              */
             $emplist .= "<td><a href='" . $uri->link("employees/edit/" . $emp->id . "") . "'>Edit</a></td>";
             foreach ($session->employee_role as $erole) {
                 //$emodule = Modules::find_by_module($erole->module);
                 $grant = array();
                 $grant = explode(",", $erole->access);
                 // if($erole->module == "employees" || $erole->module == "itdepartment" ){
                 //if(in_array("Modify",$grant)){
                 // }
                 if (in_array("Delete", $grant)) {
                     $emplist .= "<td><a href='" . $uri->link("employees/doDelete/" . $emp->id . "") . "'>Delete</a></td>";
                 } else {
                     $emplist .= "<td></td>";
                 }
                 // }
             }
             $emplist .= "\n    </tr>";
             $x++;
         }
     } else {
         $emplist .= "<tr><td colspan='7'>No record to display</td></tr>";
     }
     $emplist .= "</tbody>\n</table></div></div><div class='row'><div class='large-12 columns'>";
     $emplist .= "</div><p>&nbsp;</p></div>";
     $this->view->myemployee = $emplist;
     /**
      * the section below is 
      * provided to check for that the 
      * view to render is not called 
      * when doing ajax filter
      */
     // echo $session->empRole;
     if (Session::getRole()) {
         if (in_array(strtolower(get_class($this)), $_SESSION['emp_role_module'])) {
             if (isset($_POST['empname'])) {
                 echo $emplist;
             } elseif (isset($_POST['rec'])) {
                 echo $emplist;
             } else {
                 $this->view->render("employees/index");
             }
         } else {
             $this->view->render("access/restricted");
         }
     }
 }
Example #4
0
?>
 , View listing</a></p></div>
        <div><p><strong>No Client Ticket Awaiting response(s):</strong> <a href="<?php 
echo $uri->link("support/ticketlist");
?>
"><?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");
    }
}
?>



 public function index($mid = 1)
 {
     $productlist = "";
     if (empty($mid)) {
         redirect_to($this->uri->link("error/index"));
         exit;
     }
     $this->loadModel("Clientproduct");
     $datum = $this->model->getList("", "clientproduct");
     $this->view->myclientsproducts = $datum['clientproduct'];
     $this->view->area = Area::find_all();
     global $session;
     $uri = new Url("");
     $productlist .= "<div class='row'><div class='large-12 columns'>";
     $productlist .= "</div></div><div class='row'><div class='large-12 columns'><table  id='dt_basic'>\n            <thead><tr>\n            \t<th>S/N</th><th>Terminal ID</th><th>Product </th><th>Client</th><th>Location</th><th>City </th><th></th><th></th>";
     /**
      * check for priviledge
      * for logged in users
      * at table level
      */
     $productlist .= "<td></td></tr>\n            </thead>\n            <tbody>";
     if ($this->view->myclientsproducts) {
         $x = 1;
         foreach ($this->view->myclientsproducts as $products) {
             $productlist .= "<tr>\n                \t<td>{$x}</td><td>{$products->terminal_id}</td><td><a href='" . $uri->link("clientproduct/detail/" . $products->id) . "'>{$products->prod_name}</a> </td><td>{$products->client_name}</td><td>{$products->install_address}</td><td>{$products->install_city}</td>";
             foreach ($session->employee_role as $erole) {
                 //$emodule = Modules::find_by_module($erole->module);
                 $grant = array();
                 $grant = explode(",", $erole->access);
                 if ($erole->module == "clientproduct") {
                     if (in_array("Modify", $grant)) {
                         $productlist .= "<td><a href='" . $uri->link("clientproduct/edit/" . $products->id . "") . "'>Edit</a></td>";
                     } else {
                         $productlist .= "<td>";
                         $productlist .= "</td>";
                     }
                     if (in_array("Delete", $grant)) {
                         $productlist .= "<td><a class='dataDelete' data-reveal-id='firstModal{$products->id}' href='#'>Delete</a>\n                            \n                            \n                             <div id='firstModal{$products->id}' class='reveal-modal small' style='background-image: linear-gradient(0deg, #f2f9fc, #addcf0 20.0em); border-radius:5px'>\n    <h2>Data Delete Console.</h2>\n    <hr />\n    <p>You are about to delete a record. Any record deleted will not longer be available in the database <br /> Are you sure you want to delete <b>{$products->prod_name}</b> from the database?</p>\n    <p><a href='?url=clientproduct/doCheckTransLog/{$products->main_id}' data-reveal-id='secondModal{$products->id}' class='btn button btn-danger' data-reveal-ajax='true'>Yes</a>&nbsp; &nbsp; &nbsp;<a pdid='{$products->id}' class='btn button btn-danger modalclose'>No</a></p>\n    <a class='close-reveal-modal'>&#215;</a>\n  </div>\n\n  <div id='secondModal{$products->id}' class='reveal-modal small' style='background-image: linear-gradient(0deg, #f2f9fc, #addcf0 20.0em); border-radius:5px'>\n    <h2>This is a second modal.</h2>\n    <hr />\n\n    <a class='close-reveal-modal closemodal'>&#215;</a>\n  </div>\n                            </td><td><a <a href='" . $uri->link("clientproduct/detail/" . $products->id) . "'>Schedule</a></td>";
                     } else {
                         $productlist .= "<td></td>";
                     }
                 }
             }
             $productlist .= "</tr>";
             $x++;
         }
     } else {
         $productlist .= "<tr><td colspan='7'>No record to display</td></tr>";
     }
     $productlist .= "</tbody>\n            </table></div></div><div class='row'><div class='large-12 columns'>";
     $productlist .= "</div><p>&nbsp;</p></div>";
     $this->view->myprods = $productlist;
     /**
      * this aim of doing this check is to
      * ensure that the view is not rendered during
      * when record is being filtered fron the db
      */
     if (Session::getRole()) {
         if (in_array(strtolower(get_class($this)), $_SESSION['emp_role_module'])) {
             if (isset($_POST['areaname'])) {
                 echo $productlist;
             } elseif (isset($_POST['rec'])) {
                 echo $productlist;
             } else {
                 $this->view->render("clientproduct/index");
             }
         } else {
             $this->view->render("access/restricted");
         }
     }
 }
Example #6
0
        ?>
"><?php 
        echo _("Utiliser") . ' ' . $websiteLibelle;
        ?>
</a></li>			
					<?php 
    }
    ?>
				
				</ul>				
				<?php 
}
?>
		</li>
		<?php 
if (Session::getRole() == 1) {
    ?>
			<li>
				<img src="<?php 
    echo BASE_URL;
    ?>
/img/backoffice/icon-settings.png" alt="Settings" /> <?php 
    echo _("Configurations");
    ?>
				<ul>
					<li><a href="<?php 
    echo Router::url('backoffice/configs/core_liste');
    ?>
"><?php 
    echo _("Coeur du système");
    ?>
 /**
  * @version 0.1 - 17/01/2012 by FI
  * @version 0.2 - 25/04/2012 by FI - Rajout de la gestion de la page d'accueil
  * @version 0.3 - 30/04/2012 by FI - Gestion multisites
  * @version 0.4 - 14/06/2012 by FI - Rajout d'un contrôle nécessaire si aucun site n'est retrouné on affiche le formulaire de connexion
  * @version 0.5 - 02/04/2015 by FI - Mise en place automatisation de la traduction dans les fonctions ADD et EDIT
  * @version 0.6 - 22/04/2015 by FI - Correction pour tester l'existence de la constante CURRENT_WEBSITE_ID
  * @see Controller::beforeFilter()
  * @todo améliorer la récupération des configs...
  * @todo améliorer la récupération du menu général pour le moment une mise en cache qui me semble améliorable...
  */
 public function beforeFilter()
 {
     parent::beforeFilter();
     $prefix = isset($this->request->prefix) ? $this->request->prefix : '';
     //Récupération du préfixe
     //Si on est dans le backoffice
     if ($prefix == 'backoffice') {
         define('INTERFACE_USED', 'backoffice');
         $adminRole = Session::getRole();
         //Récupération du rôle de l'utilisateur connecté
         if (!Session::isLogged() && !$adminRole) {
             $this->redirect('users/login');
         }
         //Si pas loggé ou que l'on ne récupère pas de rôle
         $this->_check_acls($adminRole);
         //Contrôle des droits utilisateurs
         define('IS_USER_LOGGED', 'ok');
         //Récupération de l'identifiant du site courant
         if (!defined('CURRENT_WEBSITE_ID')) {
             $currentWebsite = Session::read('Backoffice.Websites.current');
             define('CURRENT_WEBSITE_ID', $currentWebsite);
         }
         $this->layout = 'backoffice';
         //Définition du layout pour le backoffice
         $this->pager['elementsPerPage'] = $this->backofficeElementPerPage;
         //Nombre d'élément par page
         $leftMenus = $this->_get_backoffice_menu();
         $this->set('leftMenus', $leftMenus);
         //Récupération des formulaires de contacts non validés
         $this->load_model('Contact');
         $nbFormsContacts = $this->Contact->findCount(array('online' => 0));
         $this->set('nbFormsContacts', $nbFormsContacts);
         //Récupération des commentaires articles
         $this->load_model('PostsComment');
         $nbPostsComments = $this->PostsComment->findCount(array('online' => 0));
         $this->set('nbPostsComments', $nbPostsComments);
         /*
         //SUPPRIME LE 02/04/2015 car cela pose des problème lors de la récupération des données pour les listes déroulantes
         //Toutes les traductions étaient récupérées or nous n'avons besoin que de la données de la langue courante du BO
         /////////////////////////////////////////
         //    PARAMETRAGES DE LA TRADUCTION    //
         $modelName = $this->params['modelName'];
         if(
         	in_array($this->params['action'], array('add', 'edit')) && 
         	isset($this->$modelName->fieldsToTranslate) && 
         	!empty($this->$modelName->fieldsToTranslate)
         ) {
         	
         	//Dans le cas de la fonction add et edit on check si on a dans le modèle des champs à traduire
         	//Le cas échéant on paramètre les données du modèle pour récupérer les données traduites
         	$this->$modelName->getTranslation 		= false; //A ce niveau la pas besoin de récupérer la traduction de l'élément
         	$this->$modelName->getTranslatedDatas 	= true; //Récupération de l'ensemble des données traduites pour affiche le formulaire
         }
         */
         //Récupération des plugins
         /*$this->load_model('Plugin');
         		$activatePlugins = $this->Plugin->find(array('conditions' => array('online' => 1)));
         		pr($activatePlugins);
         		$this->set('activatePlugins', $activatePlugins);*/
         //Si on est dans le frontoffice
     } else {
         define('INTERFACE_USED', 'frontoffice');
         //////////////////////////////////////////////////
         //   RECUPERATION DES DONNEES DU SITE COURANT   //
         //$datas['websiteParams'] = $this->_get_website_datas();
         $ws = $this->components['Website']->get_website_datas();
         $datas['websiteParams'] = $ws['website'];
         $this->layout = $ws['layout'];
         //Dans tous les cas sauf si on est sur le formulaire de connexion
         if ($this->params['controllerName'] != 'Users' && ($this->request->action != 'login' || $this->request->action != 'logout')) {
             //Si aucun site trouvé on affiche la connexion
             //$datas['websiteParams'] = $this->_get_website_datas();
             //$ws = $this->components['Website']->get_website_datas();
             //$datas['websiteParams'] = $ws['website'];
             //$this->layout = $ws['layout'];
             if (empty($datas['websiteParams'])) {
                 $datas['websiteParams']['secure_activ'] = 1;
             }
             //Si aucun site n'est retourné on affiche le formulaire de connexion
             //////////////////////////////////////////////////
             //////////////////////////////////////////////
             //   GESTION DES EVENTUELLES REDIRECTIONS   //
             $this->_is_secure_activ($datas['websiteParams']['secure_activ'], $datas['websiteParams']['log_users_activ']);
             //Site sécurisé
             //////////////////////////////////////////////
             //////////////////////////////////////////////////////////
             //   MISE EN CACHE DE LA RECUPERATION DU MENU GENERAL   //
             $datas['menuGeneral'] = $this->_get_website_menu($datas['websiteParams']['id']);
             //////////////////////////////////////////////////////////
         }
         //ON VA DEFINIR LA CONSTANTE D'ACCES AUX VUES DU TEMPLATE//
         define('LAYOUT_VIEWS', WEBROOT . DS . 'templates' . DS . $datas['websiteParams']['tpl_layout'] . DS . 'views');
         $this->set($datas);
     }
     //////////////////////////////////
     //   GESTION DE LA PAGINATION   //
     if (isset($this->request->currentPage)) {
         $this->pager['currentPage'] = $this->request->currentPage;
         //Page courante
         $this->pager['limit'] = $this->pager['elementsPerPage'] * ($this->pager['currentPage'] - 1);
         //Limit
     }
     //////////////////////////////////
 }