function User()
 {
     parent::GroupItem("User");
     $this->zoomlevel = null;
     $this->lat = null;
     $this->lon = null;
     $this->isadmin = false;
 }
 function Group()
 {
     parent::GroupItem("Group");
     $this->haschildren = false;
     $this->protection = null;
     $this->zoomlevel = null;
     $this->lat = null;
     $this->lon = null;
 }
 function File()
 {
     parent::GroupItem("File");
     $this->itemname = "empty file";
     $this->path = "";
     $this->filename = "";
     //$this->description = "";
     $this->fullfilename = "";
     $this->state = "";
 }
Пример #4
0
 public function __whenReady()
 {
     //  Check Migrations Done
     if ($this->module->migrationsDone()) {
         //  Add Permission
         addAdminPermission("manage_users", "Manage Users");
         //  Add Permission
         addAdminPermission("maintainance_mode", "Maintainance Mode Access");
         //  Add Permission
         addAdminPermission("manage_acl", "Manage Groups and Permissions");
         //  Add the Required Styles and Scripts
         registerAdminStyle("auth-admin", __DIR__ . "/styles/auth.css");
         registerAdminScript("auth-admin", __DIR__ . "/scripts/auth.js");
         setAdminStyleToUse("auth-admin");
         //  Listen Controller Ready Event
         $this->app["events"]->listen("admin.controller.ready", function () {
             //  Check Nav
             if ($nav = nav(adminNavGroup())) {
                 //  Add Logout Link
                 $nav->addMenuItem("logout", trans("auth-module::menu_item.logout"), urlRoute(UserItem::logoutRoute(), UserItem::logoutRouteParams()), null, null, 1000);
                 //  Add My Account Link
                 $nav->addSubMenuItem(ADMIN_NAV_DASHBOARD, "my_account", trans("auth-module::menu_item.my_account"), urlRoute("my_account"), null, null, 1);
                 //  Check Permission
                 if (userHasPermission("manage_acl")) {
                     //  Add ACL Navigation Items
                     $nav->detectAddSubMenuItem(ADMIN_NAV_ADMINISTRATION, "acl", trans("auth-module::menu_item.acl"), urlRoute("groups"));
                     $nav->detectAddSubSubMenuItem(ADMIN_NAV_ADMINISTRATION, "acl", "groups", trans("auth-module::menu_item.groups"), urlRoute("groups"), array("include" => array("/create_group/i", "/edit_group\\/(.*)/i")));
                     $nav->detectAddSubSubMenuItem(ADMIN_NAV_ADMINISTRATION, "acl", "permissions", trans("auth-module::menu_item.permissions"), urlRoute("permissions"), array("include" => array("/create_permission/i", "/edit_permission\\/(.*)/i")));
                 }
                 //  Check Permission
                 if (userHasPermission("manage_users")) {
                     //  Add User Navigation Items
                     $nav->detectAddSubMenuItem(ADMIN_NAV_ADMINISTRATION, "users", trans("auth-module::menu_item.users"), urlRoute("users"));
                     $nav->detectAddSubSubMenuItem(ADMIN_NAV_ADMINISTRATION, "users", "create_user", trans("auth-module::menu_item.add_new_user"), urlRoute("create_user"));
                     $nav->detectAddSubSubMenuItem(ADMIN_NAV_ADMINISTRATION, "users", "users", trans("auth-module::menu_item.view_users"), urlRoute("users"), array("include" => array("/edit_user\\/(.*)/i")));
                 }
                 //  Get Groups with Interfaces
                 $groups = GroupItem::hasInterface()->get();
                 //  Loop Each Groups
                 foreach ($groups as $group) {
                     //  Check Routes & Langs
                     if ($group->hasValidInterface() && (!$group->group_permission || userHasPermission($group->group_permission))) {
                         //  Add Navigation Items
                         $nav->detectAddSubMenuItem(ADMIN_NAV_ADMINISTRATION, $group->getRoute("list"), $group->getLang("menu_list"), urlRoute($group->getRoute("list")));
                         $nav->detectAddSubSubMenuItem(ADMIN_NAV_ADMINISTRATION, $group->getRoute("list"), $group->getRoute("create"), $group->getLang("menu_add_new"), urlRoute($group->getRoute("create")));
                         $nav->detectAddSubSubMenuItem(ADMIN_NAV_ADMINISTRATION, $group->getRoute("list"), $group->getRoute("list"), $group->getLang("menu_view_list"), urlRoute($group->getRoute("list")), array("include" => array("/" . $group->getRoute("edit") . "\\/(.*)/i")));
                     }
                 }
             }
         });
     }
 }
 function Poi()
 {
     parent::GroupItem("Poi");
     //$this->poitype = "Poi";
     $this->description = "";
 }
Пример #6
0
 /**
  * Возвращает  список  для   комбо
  * 
  */
 public static function getList()
 {
     return GroupItem::findArray('group_name', '', 'group_name');
 }
 /**
  * function createCache
  * <pre>
  * Create a cache entry for a given viewer_id and language_id
  * </pre>
  * @param $viewerID [OBJECT] the viewer object of the person to make a
  * cache entry for.
  * @return [void]
  */
 function createCache($viewer)
 {
     $viewerID = $viewer->getID();
     $languageID = $viewer->getLanguageID();
     $groupArray = array();
     // Make sure all required Row Managers are included
     $accountAdminPath = SITE_PATH_MODULES . 'site_AccountAdmin/objects_da/';
     $navBarPath = SITE_PATH_MODULES . 'site_NavBar/objects_da/';
     $pathToRoot = Page::findPathExtension($accountAdminPath);
     require_once $pathToRoot . $accountAdminPath . 'ViewerAccessGroupManager.php';
     require_once $pathToRoot . $navBarPath . 'NavBarGroupManager.php';
     require_once $pathToRoot . $navBarPath . 'NavLinkAccessGroupManager.php';
     require_once $pathToRoot . $navBarPath . 'NavLinkViewerManager.php';
     require_once $pathToRoot . $navBarPath . 'NavBarLinksManager.php';
     // get list of Links linked to this viewer
     // array of links: link_id, link_text, link_url, group_id
     $viewerLinks = $this->getViewerLinks($viewerID, $languageID);
     // get list of Links linked to this viewer's groups
     // array of links: link_id, link_text, link_url, group_id
     $groupLinks = $this->getGroupLinks($viewerID, $languageID);
     /*
      * combine lists
      */
     $combinedLinks = array();
     $usedLinks = array();
     // for each viewerLink
     for ($indx = 0; $indx < count($viewerLinks); $indx++) {
         // compute a link key
         $linkKey = $viewerLinks[$indx]['navbarlink_url'] . '[' . $viewerLinks[$indx]['module_id'] . ']';
         // if this link key has not already been added (no duplicate links)
         if (!key_exists($linkKey, $usedLinks)) {
             $usedLinks[$linkKey] = $linkKey;
             $combinedLinks[] = $viewerLinks[$indx];
         }
     }
     // for each groupLink
     for ($indx = 0; $indx < count($groupLinks); $indx++) {
         $linkKey = $groupLinks[$indx]['navbarlink_url'] . '[' . $groupLinks[$indx]['module_id'] . ']';
         if (!key_exists($linkKey, $usedLinks)) {
             $usedLinks[$linkKey] = $linkKey;
             $combinedLinks[] = $groupLinks[$indx];
         }
     }
     // for each link in combinedLinks
     for ($indx = 0; $indx < count($combinedLinks); $indx++) {
         // if groupObject in GroupArray then
         $groupID = (int) $combinedLinks[$indx]['navbargroup_id'];
         if (!key_exists($groupID, $groupArray)) {
             // create new group Object
             $group = new GroupItem();
             $groupManager = new RowManager_NavBarGroupManager($groupID);
             $multiLingualContext = new MultilingualManager($languageID);
             $bridgeManager = $groupManager->getRowLabelBridge($multiLingualContext);
             $group->loadFromArray($bridgeManager->getArrayOfValues());
             // store in GroupArray
             $groupArray[$groupID] = $group;
         }
         // end if
         // Add link Object to Group Object
         $link = new LinkItem();
         $link->loadFromArray($combinedLinks[$indx]);
         $groupArray[$groupID]->addItem($link);
     }
     // next item
     // Now manually sort the group Items since we couldn't get the SQL
     // to sort it.
     $sortedArray = array();
     foreach ($groupArray as $group) {
         $key = $group->getOrder() . $group->getText();
         $sortedArray[$key] = $group;
     }
     ksort($sortedArray);
     // send array of group objects to Template
     $template = new Template($pathToRoot . SITE_PATH_MODULES . 'site_NavBar/templates/');
     $template->set('arrayGroup', $sortedArray);
     $template->set('pathToRoot', $this->getPathToRootTag());
     // get cache data from template
     $cacheData = $template->fetch('obj_NavBar.php');
     $cacheData = str_replace('[userID]', $viewer->getUserID(), $cacheData);
     $cacheData = str_replace('[passWord]', $viewer->getPassword(), $cacheData);
     if ((int) $viewer->getLanguageID() == 1) {
         $cacheData = str_replace('[gtsLanguageID]', 'en', $cacheData);
     } else {
         $cacheData = str_replace('[gtsLanguageID]', 'chi', $cacheData);
     }
     // store cache data in this object
     $this->setValueByFieldName('navbarcache_cache', $cacheData);
     //echo 'cacheData=[<pre>'.$cacheData.'</pre>]<br>';
     // set isValid to true
     $this->setCacheValid();
     $this->setViewerID($viewerID);
     $this->setLanguageID($languageID);
     // update DB Table
     if ($this->isLoaded()) {
         $this->updateDBTable();
     } else {
         $this->createNewEntry();
     }
 }
Пример #8
0
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return GroupItem the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = GroupItem::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }