示例#1
0
 public function execute()
 {
     $album_model = new photosAlbumModel();
     $albums = $album_model->getAlbums(false, photosAlbumModel::TYPE_STATIC, $this->getRights('edit') ? false : true, false);
     $this->view->assign('albums', $albums);
     $group_model = new waGroupModel();
     $groups = $group_model->getNames();
     $this->view->assign('groups', $groups);
 }
 public function execute()
 {
     if (!$this->getRights('upload')) {
         throw new waRightsException(_w("You don't have sufficient access rights"));
     }
     $groups_model = new waGroupModel();
     $this->view->assign('groups', $groups_model->getNames());
     $photo_tag_model = new photosTagModel();
     $cloud = $photo_tag_model->getCloud('name');
     $this->view->assign('cloud', $cloud);
 }
 public function execute()
 {
     if (!$this->getRights('upload')) {
         throw new waRightsException(_w("You don't have sufficient access rights"));
     }
     $parent_id = waRequest::get('parent_id', 0, waRequest::TYPE_INT);
     $parent = null;
     if ($parent_id) {
         $album_model = new photosAlbumModel();
         $parent = $album_model->getById($parent_id);
     }
     $this->view->assign('parent', $parent);
     $groups_model = new waGroupModel();
     $this->view->assign('groups', $groups_model->getNames());
     $photo_tag_model = new photosTagModel();
     $cloud = $photo_tag_model->getCloud('name');
     $this->view->assign('cloud', $cloud);
 }
 /**
  * Returns list of all user groups
  *
  * @example returns array(
  *     1 => 'Group 1',
  *     2 => 'Group 2',
  *     ...
  * )
  *
  * @return array - associative array with key group id and value group name
  */
 public static function getAllGroups()
 {
     $group_model = new waGroupModel();
     return $group_model->getNames();
 }
 /** Using $this->id and $this->contact, if contact is a user,
  * collect and load vars into $this->view specific to waUser. */
 protected function getUserInfo()
 {
     $system = waSystem::getInstance();
     $rm = new waContactRightsModel();
     $ugm = new waUserGroupsModel();
     $gm = new waGroupModel();
     // Personal and group access rights
     $groups = $ugm->getGroups($this->id);
     $ownAccess = $rm->getApps(-$this->id, 'backend', FALSE, FALSE);
     $groupAccess = $rm->getApps(array_keys($groups), 'backend', FALSE, FALSE);
     if (!isset($ownAccess['webasyst'])) {
         $ownAccess['webasyst'] = 0;
     }
     if (!isset($groupAccess['webasyst'])) {
         $groupAccess['webasyst'] = 0;
     }
     // Build application list with personal and group access rights for each app
     $apps = $system->getApps();
     $noAccess = true;
     $gNoAccess = true;
     foreach ($apps as $app_id => &$app) {
         $app['id'] = $app_id;
         $app['customizable'] = isset($app['rights']) ? (bool) $app['rights'] : false;
         $app['access'] = $ownAccess['webasyst'] ? 2 : 0;
         if (!$app['access'] && isset($ownAccess[$app_id])) {
             $app['access'] = $ownAccess[$app_id];
         }
         $app['gaccess'] = $groupAccess['webasyst'] ? 2 : 0;
         if (!$app['gaccess'] && isset($groupAccess[$app_id])) {
             $app['gaccess'] = $groupAccess[$app_id];
         }
         $noAccess = $noAccess && !$app['gaccess'] && !$app['access'];
         $gNoAccess = $gNoAccess && !$app['gaccess'];
     }
     unset($app);
     $this->view->assign('apps', $apps);
     $this->view->assign('groups', $groups);
     $this->view->assign('noAccess', $noAccess ? 1 : 0);
     $this->view->assign('gNoAccess', $gNoAccess ? 1 : 0);
     $this->view->assign('all_groups', $gm->getNames());
     $this->view->assign('fullAccess', $ownAccess['webasyst']);
     $this->view->assign('gFullAccess', $groupAccess['webasyst']);
     $this->view->assign('access_to_contacts', $this->getUser()->getRights('contacts', 'backend'));
 }