예제 #1
0
 public function __construct($userId)
 {
     parent::__construct($userId);
     // set superior ID (client's id) if needed
     // todo: possible use cache?
     $cpModel = new ClientPackagesModel();
     $this->superiorId = $cpModel->getClientIdOfLoggedUser();
 }
예제 #2
0
파일: BaseRole.php 프로젝트: yasirgit/afids
 /**
  * Returns a peer instance associated with this om.
  *
  * Since Peer classes are not to have any instance attributes, this method returns the
  * same instance for all member of this class. The method could therefore
  * be static, but this would prevent one from overriding the behavior.
  *
  * @return     RolePeer
  */
 public function getPeer()
 {
     if (self::$peer === null) {
         self::$peer = new RolePeer();
     }
     return self::$peer;
 }
예제 #3
0
     $role = new BaseRole();
     $rolearray = array(filterSql($_POST['role_id']), filterSql($_POST['role_name']), filterSql($_POST['desc']));
     $role->updateRole($rolearray);
     base_header("Location: base_roleadmin.php?action=list");
     break;
 case "deleterole":
     // Deletes role
     $roleid = filterSql($_GET['roleid']);
     $BRole = new BaseRole();
     $BRole->deleteRole($roleid);
     base_header("Location: base_roleadmin.php?action=list");
     break;
 case "list":
     // lists the roles
     // Build table to list roles and return it as $roletable
     $role = new BaseRole();
     $roles = $role->returnRoles();
     $tmpHTML = "<TABLE CELLSPACING=0 CELLPADDING=2 BORDER=0 WIDTH='100%' BGCOLOR='#000000'><TR><TD>";
     $tmpHTML = $tmpHTML . "<table CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH='100%' BGCOLOR='#FFFFFF'>";
     $tmpHTML = $tmpHTML . "<tr><td CLASS='plfieldhdr' width=25>" . _EDIT . "</td><td CLASS='plfieldhdr' width=35>&nbsp;" . _DELETE . "</td><td CLASS='plfieldhdr'>" . _ID . "</td><td CLASS='plfieldhdr'>" . _NAME;
     $tmpHTML = $tmpHTML . "</td><td CLASS='plfieldhdr'>" . _DESC . "</td></tr>";
     foreach ($roles as $row) {
         //explode array rows and build table
         $tmpRow = explode("|", $row);
         $tmpHTML = $tmpHTML . "<tr><td align='center'><a href='base_roleadmin.php?action=editrole&amp;roleid=" . urlencode($tmpRow[0]) . "'>";
         $tmpHTML = $tmpHTML . "<img src='" . $BASE_urlpath . "/images/button_edit.png' border='0' alt='button_edit'></a></td>";
         $tmpHTML = $tmpHTML . "<td align='center'><a href='base_roleadmin.php?action=deleterole&amp;roleid=" . urlencode($tmpRow[0]) . "'>";
         $tmpHTML = $tmpHTML . "<img src='" . $BASE_urlpath . "/images/button_delete.png' border='0' alt='button_delete'></a></td>";
         $tmpHTML = $tmpHTML . "<td align='center'>" . htmlspecialchars($tmpRow[0]);
         $tmpHTML = $tmpHTML . "</td><td align='center'>" . htmlspecialchars($tmpRow[1]);
         $tmpHTML = $tmpHTML . "</td><td align='center'>" . htmlspecialchars($tmpRow[2]);
예제 #4
0
파일: Role.php 프로젝트: awecode/awecms
 public function init()
 {
     return parent::init();
 }
예제 #5
0
파일: Role.php 프로젝트: GatuZa/test-app
 /**
  * @param string $className
  *
  * @return CActiveRecord
  */
 public static function model($className = __CLASS__)
 {
     return parent::model($className);
 }
예제 #6
0
 /**
  * Delete this role
  *
  * @param void
  * @return boolean
  */
 function delete()
 {
     if ($this->getUsersCount() > 0) {
         return new Error('Role cannot be deleted as long as there are users having it');
     }
     // if
     return parent::delete();
 }