public function service()
 {
     $categoryManager = new CategoryManager($this->config, $this->args);
     $categoryId = $this->secure($_REQUEST["category_id"]);
     $display_name = $this->secure($_REQUEST["display_name"]);
     $last_clickable = $this->secure($_REQUEST["last_clickable"]);
     $adminManager = new AdminManager($this->config, $this->args);
     $adminId = $this->sessionManager->getUser()->getId();
     $adminDto = $adminManager->selectByPK($adminId);
     if ($adminDto) {
         $categoryDto = $categoryManager->getCategoryById($categoryId);
         if (!$categoryDto) {
             $jsonArr = array('status' => "err", "errText" => "System Error: Category doesn't exist!");
             echo json_encode($jsonArr);
             return false;
         }
         $categoryManager->updateCategoryAttributes($categoryId, $display_name, $last_clickable);
         $jsonArr = array('status' => "ok", "message" => "ok");
         echo json_encode($jsonArr);
         return true;
     } else {
         $jsonArr = array('status' => "err", "errText" => "System Error: You are not Admin!");
         echo json_encode($jsonArr);
         return false;
     }
 }
 public function service()
 {
     $login = strtolower($this->secure($_REQUEST['login']));
     $password = $this->secure($_REQUEST['password']);
     $adminManager = new AdminManager($this->config, $this->args);
     $adminDto = $adminManager->getAdminByEmailAndPassword($login, $password);
     if (isset($adminDto)) {
         $user = new AdminUser($adminDto->getId());
         $user->setUniqueId($adminDto->getHash());
         $this->sessionManager->setUser($user, true, true);
     }
     $this->redirect('admin');
 }
 /**
  * Returns an singleton instance of this class
  *
  * @param object $config
  * @param object $args
  * @return
  */
 public static function getInstance($config, $args)
 {
     if (self::$instance == null) {
         self::$instance = new AdminManager($config, $args);
     }
     return self::$instance;
 }
 public function deleteRow($aRowData, $oCriteria)
 {
     $oLanguage = LanguagePeer::doSelectOne($oCriteria);
     if ($oLanguage->getIsDefault()) {
         throw new LocalizedException('wns.language.delete_default.denied');
     }
     if ($oLanguage->getIsDefaultEdit()) {
         throw new LocalizedException('wns.language.delete_default.denied');
     }
     if (LanguagePeer::doCount(new Criteria()) < 2) {
         throw new LocalizedException('wns.language.delete_last.denied');
     }
     $sLanguageId = $oLanguage->getId();
     foreach (LanguageObjectQuery::create()->filterByLanguageId($sLanguageId)->find() as $oLanguageObject) {
         $oHistory = $oLanguageObject->newHistory();
         $oHistory->save();
         $oLanguageObject->delete();
     }
     $iResult = $oLanguage->delete();
     $oReplacementLanguage = LanguageQuery::create()->findOne();
     if (AdminManager::getContentLanguage() === $sLanguageId) {
         AdminManager::setContentLanguage(Settings::getSetting("session_default", AdminManager::CONTENT_LANGUAGE_SESSION_KEY, $oReplacementLanguage->getId()));
     }
     if (Session::language() === $sLanguageId) {
         Session::getSession()->setLanguage(Settings::getSetting("session_default", Session::SESSION_LANGUAGE_KEY, $oReplacementLanguage->getId()));
     }
 }
 public function getMetadataForColumn($sColumnIdentifier)
 {
     $aResult = array('is_sortable' => true);
     switch ($sColumnIdentifier) {
         case 'id':
             $aResult['heading'] = false;
             $aResult['field_name'] = 'string_key';
             $aResult['display_type'] = ListWidgetModule::DISPLAY_TYPE_DATA;
             break;
         case 'string_key':
             $aResult['heading'] = TranslationPeer::getString('wns.string.string_key');
             break;
         case 'text_truncated_current':
             $aResult['heading'] = TranslationPeer::getString('wns.string.string_text.heading', null, 'Text', array('language_id' => AdminManager::getContentLanguage()));
             break;
         case 'languages_available':
             $aResult['heading'] = TranslationPeer::getString('wns.languages_filled');
             $aResult['is_sortable'] = false;
             break;
         case 'delete':
             $aResult['heading'] = ' ';
             $aResult['display_type'] = ListWidgetModule::DISPLAY_TYPE_ICON;
             $aResult['field_name'] = 'trash';
             $aResult['is_sortable'] = false;
             break;
     }
     return $aResult;
 }
 public function load()
 {
     $companyManager = CompanyManager::getInstance($this->config, $this->args);
     $adminManager = AdminManager::getInstance($this->config, $this->args);
     $userManager = UserManager::getInstance($this->config, $this->args);
     $companyDealersManager = CompanyDealersManager::getInstance($this->config, $this->args);
     $allAdmins = $adminManager->selectAll();
     if ($this->getUserLevel() === UserGroups::$COMPANY) {
         $allCompanies = $companyManager->getAllCompanies();
         $companyDealersJoindWithUsersFullInfo = $companyDealersManager->getCompanyDealersJoindWithUsersFullInfo($this->getUserId());
         $this->addParam('allCompanies', $allCompanies);
         $this->addParam('allDealers', $companyDealersJoindWithUsersFullInfo);
         $this->addParam('allAdmins', $allAdmins);
     }
     if ($this->getUserLevel() === UserGroups::$SERVICE_COMPANY) {
         $allCompanies = $companyManager->getAllCompanies();
         $this->addParam('allCompanies', $allCompanies);
         $this->addParam('allAdmins', $allAdmins);
     }
     if ($this->getUserLevel() === UserGroups::$ADMIN) {
         $allCompanies = $companyManager->getAllCompanies(true, true);
         $allUsers = $userManager->selectAll();
         $this->addParam('allCompanies', $allCompanies);
         $this->addParam('allUsers', $allUsers);
         $this->addParam('allAdmins', $allAdmins);
     }
     if ($this->getUserLevel() === UserGroups::$USER) {
         $allCompanies = $companyManager->getAllCompanies();
         $allUsers = $userManager->selectAll();
         $dealerCompanies = $companyManager->getUserCompaniesJoindWithFullInfo($this->getUserId());
         $this->addParam('allCompanies', $dealerCompanies);
         //$this->addParam('allUsers', $allUsers);
         $this->addParam('allAdmins', $allAdmins);
     }
 }
 public function service()
 {
     $adminManager = AdminManager::getInstance($this->config, $this->args);
     $price_group = $_REQUEST['price_group'];
     $adminManager->setPriceGroup($this->getUserId(), $price_group);
     $this->ok();
 }
 public function service()
 {
     $categoryManager = CategoryManager::getInstance($this->config, $this->args);
     $categoryHierarchyManager = CategoryHierarchyManager::getInstance($this->config, $this->args);
     $categoryId = $this->secure($_REQUEST["category_id"]);
     $adminManager = AdminManager::getInstance($this->config, $this->args);
     $adminId = $this->sessionManager->getUser()->getId();
     $adminDto = $adminManager->selectByPK($adminId);
     if ($adminDto) {
         if ($categoryHierarchyManager->hasCategoryChildren($categoryId)) {
             $jsonArr = array('status' => "err", "errText" => "You can only remove 'Leaf' categories!");
             echo json_encode($jsonArr);
             return false;
         }
         $categoryManager->deleteByPK($categoryId);
         $categoryHierarchyManager->removeCategoryHierarchyByChildCategoryID($categoryId);
         //todo remove category name from items table `categories_names` field.
         $jsonArr = array('status' => "ok", "message" => "ok");
         echo json_encode($jsonArr);
         return true;
     } else {
         $jsonArr = array('status' => "err", "errText" => "System Error: You are not Admin!");
         echo json_encode($jsonArr);
         return false;
     }
 }
 /** 
  * @brief	Retourne l'instance de la classe et permet d'instancier un AdminManager si c'est le premier appel.
  * @return	AdminManager		Retourne l'instance de la classe AdminManager
  */
 public static function instance()
 {
     if (self::$instance == null) {
         self::$instance = new AdminManager();
     }
     return self::$instance;
 }
 /**
  * register guest user
  *
  * @return int userId
  */
 public function register()
 {
     $this->setCookieParam("ut", UserGroups::$ADMIN);
     $user = AdminManager::getInstance()->register();
     $this->setUniqueId($user->getHashcode());
     $this->setId($user->getId());
     return $user->getId();
 }
 public function search()
 {
     $input = Input::all();
     if (!$input['keyword'] && !$input['role_id']) {
         return Redirect::action('ManagerController@index');
     }
     $data = AdminManager::searchUserOperation($input);
     return View::make('admin.manager.index')->with(compact('data'));
 }
 public function getConfigurationModes()
 {
     $aResult = array();
     $aResult['templates'] = AdminManager::getSiteTemplatesForListOutput();
     $aResult['tags'] = array();
     foreach (TagPeer::doSelect(new Criteria()) as $oTag) {
         $aResult['tags'][] = array('name' => $oTag->getName(), 'count' => $oTag->countTagInstances(), 'id' => $oTag->getId());
     }
     $aResult['types'] = TagInstancePeer::getTaggedModels();
     return $aResult;
 }
 public function service()
 {
     $categoryManager = new CategoryManager($this->config, $this->args);
     $categoryHierarchyManager = new CategoryHierarchyManager($this->config, $this->args);
     $categoryTitle = $this->secure($_REQUEST["category_title"]);
     $parentCategoryId = $this->secure($_REQUEST["parent_category_id"]);
     $adminManager = new AdminManager($this->config, $this->args);
     $adminId = $this->sessionManager->getUser()->getId();
     $adminDto = $adminManager->selectByPK($adminId);
     if ($adminDto) {
         $sortIndex = count($categoryHierarchyManager->getCategoryChildrenIdsArray($parentCategoryId)) + 1;
         $categoryId = $categoryManager->addCategory($categoryTitle, '0', '0', '1');
         $categoryHierarchyManager->addSubCategoryToCategory($parentCategoryId, $categoryId, $sortIndex);
         $jsonArr = array('status' => "ok", "message" => "ok");
         echo json_encode($jsonArr);
         return true;
     } else {
         $jsonArr = array('status' => "err", "errText" => "System Error: You are not Admin!");
         echo json_encode($jsonArr);
         return false;
     }
 }
 public function service()
 {
     //todo check if user have access to given company
     $adminManager = new AdminManager($this->config, $this->args);
     $adminId = $this->sessionManager->getUser()->getId();
     $adminDto = $adminManager->selectByPK($adminId);
     if (!$adminDto) {
         return false;
     }
     $companyId = $this->args[0];
     $companyManager = CompanyManager::getInstance($this->config, $this->args);
     $company = $companyManager->selectByPK($companyId);
     if (!$company) {
         return false;
     }
     $ex = new excel_xml();
     $header_style = array('bold' => 1, 'size' => '12', 'color' => '#FFFFFF', 'bgcolor' => '#4F81BD');
     $ex->add_style('header', $header_style);
     $ex->add_row(array('Name', 'Price', 'VAT Price'), 'header');
     $itemManager = ItemManager::getInstance($this->config, $this->args);
     $items = $itemManager->getCompanyItems($companyId);
     foreach ($items as $key => $itemDto) {
         $row = array();
         $name = $itemDto->getDisplayName();
         $row[] = $name;
         $price_usd = $itemDto->getDealerPrice();
         $row[] = '$' . $price_usd;
         if ($itemDto->getVatPrice() > 0) {
             $price_vat_usd = $itemDto->getVatPrice();
             $row[] = '$' . $price_vat_usd;
         }
         //$price_amd = $itemManager->exchangeFromUsdToAMD($itemDto->getDealerPrice());
         $ex->add_row($row);
     }
     $ex->create_worksheet('Items');
     $ex->generate();
     $ex->download($company->getName());
 }
 public function languageData()
 {
     $oLanguage = LanguageQuery::create()->findPk($this->sLanguageId);
     $aResult = $oLanguage->toArray();
     $aResult['LanguageName'] = $oLanguage->getLanguageName();
     $aResult['CreatedInfo'] = Util::formatCreatedInfo($oLanguage);
     $aResult['UpdatedInfo'] = Util::formatUpdatedInfo($oLanguage);
     $sLanguageKey = LanguagePeer::STATIC_STRING_NAMESPACE . '.' . $this->sLanguageId;
     // check existence of translation string in its own language
     if (TranslationPeer::getString($sLanguageKey, $this->sLanguageId, '') === '') {
         $sMessage = TranslationPeer::getString('wns.check_static_strings', AdminManager::getContentLanguage(), 'Please check strings', $aParameters = array('string_key' => $sLanguageKey));
         $aResult['LanguageStringMissing'] = $sMessage;
     }
     return $aResult;
 }
Exemple #16
0
 protected function initLanguage()
 {
     $this->sOldSessionLanguage = Session::language();
     if (isset($_REQUEST[AdminManager::CONTENT_LANGUAGE_SESSION_KEY]) && LanguageQuery::languageExists($_REQUEST[AdminManager::CONTENT_LANGUAGE_SESSION_KEY])) {
         AdminManager::setContentLanguage($_REQUEST[AdminManager::CONTENT_LANGUAGE_SESSION_KEY]);
         unset($_REQUEST[AdminManager::CONTENT_LANGUAGE_SESSION_KEY]);
         LinkUtil::redirect(LinkUtil::link(Manager::getRequestedPath(), get_class()));
     } else {
         if (!LanguageQuery::languageExists(AdminManager::getContentLanguage())) {
             AdminManager::setContentLanguage($this->sOldSessionLanguage);
         }
         if (!LanguageQuery::languageExists(AdminManager::getContentLanguage())) {
             LinkUtil::redirectToManager('', "AdminManager");
         }
     }
     Session::getSession()->setLanguage(AdminManager::getContentLanguage());
 }
Exemple #17
0
 public function exclude($mExclude = false)
 {
     if (!$mExclude) {
         return $this;
     }
     if ($mExclude === 'default') {
         $mExclude = Settings::getSetting("session_default", Session::SESSION_LANGUAGE_KEY, 'de');
     } else {
         if ($mExclude === 'current') {
             $mExclude = Session::language();
         } else {
             if ($mExclude === 'edit') {
                 $mExclude = AdminManager::getContentLanguage();
             } else {
                 if ($mExclude instanceof Language) {
                     $mExclude = $mExclude->getId();
                 }
             }
         }
     }
     return $this->filterById($mExclude, Criteria::NOT_EQUAL);
 }
 public function service()
 {
     $sound_on = $_REQUEST['on'] == 1 ? 1 : 0;
     if ($this->getUserLevel() != UserGroups::$GUEST) {
         $customerId = $this->getUserId();
         switch ($this->getUserLevel()) {
             case UserGroups::$USER:
                 $userManager = UserManager::getInstance($this->config, $this->args);
                 $userManager->enableSound($customerId, $sound_on);
                 break;
             case UserGroups::$COMPANY:
                 $companyManager = CompanyManager::getInstance($this->config, $this->args);
                 $companyManager->enableSound($customerId, $sound_on);
                 break;
             case UserGroups::$ADMIN:
                 $adminManager = AdminManager::getInstance($this->config, $this->args);
                 $adminManager->enableSound($customerId, $sound_on);
                 break;
         }
         $this->ok();
     }
 }
 public function login($sUserName, $sPassword)
 {
     if ($sUserName === '' || $sPassword === '') {
         throw new LocalizedException('flash.login.empty_fields');
     }
     $iLoginResult = Session::getSession()->login($sUserName, $sPassword);
     if (($iLoginResult & Session::USER_IS_VALID) === Session::USER_IS_VALID) {
         Session::getSession()->setLanguage(Session::getSession()->getUser()->getLanguageId());
         return array('is_valid' => true);
     } else {
         if (($iLoginResult & Session::USER_IS_INACTIVE) === Session::USER_IS_INACTIVE) {
             throw new LocalizedException('flash.login_user_inactive');
         } else {
             if (($iLoginResult & Session::USER_NEEDS_PASSWORD_RESET) === Session::USER_NEEDS_PASSWORD_RESET) {
                 return array('needs_password_reset' => true);
             }
         }
     }
     if (AdminManager::initializeFirstUserIfEmpty($sUserName, $sPassword)) {
         throw new LocalizedException('flash.login_welcome2', array('username' => $sUserName, 'password' => $sPassword));
     }
     throw new LocalizedException('flash.login_check_params');
 }
 /**
  * remove an admin from a node of org tree
  * @param int $treeidst the idst of the tree to add
  * @param int $adminidst the security token of the administrator
  */
 function removeAdminTree($treeidst, $adminidst)
 {
     $query = "DELETE FROM " . AdminManager::getAdminTreeTable() . " WHERE idst = '" . $treeidst . "'" . "   AND idstAdmin = '" . $adminidst . "'";
     $this->_executeQuery($query);
 }
function adminManager_edit_menu()
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.form.php';
    require_once _base_ . '/lib/lib.tab.php';
    require_once $GLOBALS['where_framework'] . '/lib/lib.adminmanager.php';
    $lang =& DoceboLanguage::createInstance('adminrules', 'framework');
    $aclManager =& Docebo::user()->getAclManager();
    $adminidst = importVar('adminidst', true, 0);
    $out =& $GLOBALS['page'];
    $admin_manager = new AdminManager();
    // perform other platforms login operation
    require_once _base_ . '/lib/lib.platform.php';
    $pm =& PlatformManager::createInstance();
    //prefetching tab-------------------------------------------
    $tabs = new TabView('admin_menu_tab_editing', 'index.php?modname=admin_manager&amp;op=edit_menu&amp;adminidst=' . $adminidst);
    $plat = $pm->getPlatformList();
    $active_tab = importVar('tab', false, 'framework');
    foreach ($plat as $code => $descr) {
        if (isset($_POST['tabelem_' . $code . '_status'])) {
            $active_tab = $code;
        }
        $tab = new TabElemDefault($code, $lang->def('_MENU_MANAGE_' . strtoupper($code)), getPathImage() . 'main_zone/' . $code . '.gif');
        $tabs->addTab($tab);
    }
    $admin_menu =& $pm->getPlatformAdminMenuInstance($active_tab);
    $all_admin_permission =& $admin_manager->getAdminPermission($adminidst);
    // save if is it required
    if (isset($_POST['save_permission'])) {
        $re = $admin_menu->savePreferences($_POST, $adminidst, $all_admin_permission);
        $all_admin_permission =& $admin_manager->getAdminPermission($adminidst);
    }
    $tabs->setActiveTab($active_tab);
    $out->setWorkingZone('content');
    $out->add(getTitleArea($lang->def('_ADMIN_MANAGMENT'), 'admin_managmer', $lang->def('_ADMIN_MANAGMENT')) . '<div class="std_block">' . $tabs->printTabView_Begin() . Form::openForm('admin_menu_editing', '') . Form::getHidden('adminidst', 'adminidst', $adminidst) . Form::getHidden('tab', 'tab', $active_tab) . ($admin_menu !== false ? $admin_menu->getPermissionUi($all_admin_permission, 'admin_menu_editing', 'admin_menu_editing') : '') . Form::openButtonSpace() . Form::getButton('save_permission', 'save_permission', $lang->def('_SAVE')) . Form::getButton('undo_pref', 'undo_pref', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm() . $tabs->printTabView_End() . '</div>');
}
 public function setContentLanguage($sLanguage)
 {
     AdminManager::setContentLanguage($sLanguage);
 }
<?php

defined("_nova_district_token_") or die('');
//RECUPERATION DE LA RECHERCHE
if (isset($_POST['search-doctorname']) and $_POST['search-doctorname'] != "") {
    $doctor_result = DoctorsManager::instance()->searchByName($_POST['search-doctorname']);
    if (count($doctor_result) == 0) {
        $error = new Error('Aucun médecin trouvé à ce nom');
        $errors['admin_doctors'] = $error;
    }
}
//ENVOI D'UN MSG
if (isset($_POST['message_to_user']) and isset($_GET['msg_id'])) {
    $message = AdminManager::instance()->sendMessage($_GET['msg_id'], $_POST['message_to_user']);
    $errors["msg-admin-members"] = $message;
}
//CHANGEMENT DE STATUT
if (isset($_GET['id']) and isset($_GET['idmed']) and isset($_POST['status'])) {
    $statusChange = AdminManager::instance()->changeStatus($_GET['id'], $_POST['status'], $_GET['idmed']);
    if (Tools::getClass($statusChange) == "Error") {
        $errors["status_change"] = $statusChange;
    }
}
//RECUPERATION DES DEMANDES EN COURS
$future_doctor_result = AdminManager::instance()->searchAllFutureDoctors();
if (Tools::getClass($future_doctor_result) == "Error") {
    $errors["admin_future_doctors"] = $future_doctor_result;
}
//inclusion de la vue correspondante
include dirname(__FILE__) . '/../../views/modules/admin-practicians.php';
 public function getCustomer()
 {
     if (!$this->customer) {
         if ($this->getUserLevel() != UserGroups::$GUEST) {
             $userId = $this->getUserId();
             if ($this->getUserLevel() == UserGroups::$USER) {
                 $userManager = new UserManager($this->config, $this->args);
                 $this->customer = $userManager->selectByPK($userId);
             } else {
                 if ($this->getUserLevel() == UserGroups::$COMPANY) {
                     $customerManager = new CompanyManager($this->config, $this->args);
                     $this->customer = $customerManager->selectByPK($userId);
                 } else {
                     if ($this->getUserLevel() == UserGroups::$SERVICE_COMPANY) {
                         $customerManager = new ServiceCompanyManager($this->config, $this->args);
                         $this->customer = $customerManager->selectByPK($userId);
                     } else {
                         if ($this->getUserLevel() == UserGroups::$ADMIN) {
                             $adminManager = new AdminManager($this->config, $this->args);
                             $this->customer = $adminManager->selectByPK($userId);
                         }
                     }
                 }
             }
         }
     }
     return $this->customer;
 }
Exemple #25
0
 public static function initializeFirstUserIfEmpty($sUsername = null, $sPassword = null)
 {
     if (UserQuery::create()->count() > 0) {
         return false;
     }
     $sUsername = $sUsername !== null ? $sUsername : ADMIN_USERNAME;
     $sPassword = $sPassword !== null ? $sPassword : ADMIN_PASSWORD;
     $oUser = new User();
     $oUser->setPassword($sPassword);
     $oUser->setFirstName($sUsername);
     $oUser->setUsername($sUsername);
     $oUser->setIsAdmin(true);
     $oUser->setLanguageId(Settings::getSetting("session_default", Session::SESSION_LANGUAGE_KEY, 'en'));
     UserPeer::ignoreRights(true);
     $oUser->save();
     UserPeer::ignoreRights(false);
     // make sure that this first language exists and is the content language too
     AdminManager::createLanguageIfNoneExist(Session::language(), $oUser);
     AdminManager::setContentLanguage(Session::language());
     return true;
 }
 function org_createUser($treeid = FALSE)
 {
     checkPerm('createuser_org_chart', false, 'directory', 'framework');
     require_once _base_ . '/lib/lib.form.php';
     $title_page = array($this->lang->def('_USERS'), $this->lang->def('_NEW_USER'));
     $control_view = 1;
     $data = new GroupDataRetriever($GLOBALS['dbConn'], $GLOBALS['prefix_fw']);
     $rend = new Table(Get::sett('visuItem'));
     $lv = new GroupListView('', $data, $rend, 'groupdirectory');
     $group_count = $lv->getTotalRows();
     $query_org_chart = "SELECT COUNT(*)" . " FROM " . $GLOBALS['prefix_fw'] . "_org_chart_tree";
     list($number_of_folder) = sql_fetch_row(sql_query($query_org_chart));
     if ($number_of_folder == 0 && $group_count == 0) {
         $control_view = 0;
     }
     $GLOBALS['page']->add(getTitleArea($title_page, 'directory_people') . '<div class="std_block">');
     if ($control_view && (Get::sett('use_org_chart') == '1' || $GLOBALS['use_groups'] == '1')) {
         if (isset($_POST['okselector'])) {
             // go to user creation with folders selected
             require_once dirname(__FILE__) . '/../modules/org_chart/tree.org_chart.php';
             $repoDb = new TreeDb_OrgDb($GLOBALS['prefix_fw'] . '_org_chart_tree');
             $arr_selection = $this->getSelection($_POST);
             if (count($arr_selection) > 0) {
                 $arr_selection = array_merge($arr_selection, $repoDb->getDescendantsSTFromST($arr_selection));
             }
             $arr_selection = array_merge($arr_selection, $this->aclManager->getArrGroupST(array('/oc_0', '/ocd_0')));
             $this->editPerson(FALSE, $arr_selection);
         } elseif (isset($_POST['cancelselector'])) {
             Util::jump_to('index.php?modname=directory&op=org_chart');
         } else {
             if (!isset($_GET['stayon'])) {
                 if ($treeid === FALSE && isset($_GET['treeid'])) {
                     $treeid = (int) $_GET['treeid'];
                 }
                 if ($treeid != 0) {
                     require_once dirname(__FILE__) . '/../modules/org_chart/tree.org_chart.php';
                     $repoDb = new TreeDb_OrgDb($GLOBALS['prefix_fw'] . '_org_chart_tree');
                     $idst = $repoDb->getGroupST($treeid);
                     $this->resetSelection(array($idst));
                 } else {
                     $this->resetSelection(array());
                 }
             }
             $this->show_user_selector = FALSE;
             if ($group_count == 0) {
                 $this->show_group_selector = FALSE;
             } else {
                 $this->show_group_selector = TRUE;
             }
             if (Get::sett('use_org_chart') == '1' && $number_of_folder != 0) {
                 $this->show_orgchart_selector = TRUE;
                 $this->show_orgchart_simple_selector = TRUE;
             } else {
                 $this->show_orgchart_selector = FALSE;
             }
             if (Docebo::user()->getUserLevelId() === '/framework/level/admin') {
                 require_once $GLOBALS['where_framework'] . '/lib/lib.adminmanager.php';
                 $adminManager = new AdminManager();
                 $this->setGroupFilter('group', $adminManager->getAdminTree(getLogUserId()));
             }
             $this->loadSelector('index.php?modname=directory&amp;op=org_createuser&amp;stayon=1', $this->lang->def('_NEW_USER'), $this->lang->def('_NEW_USERDESCR'), TRUE);
         }
     } else {
         $this->editPerson(FALSE, array());
     }
     $GLOBALS['page']->add('</div>');
 }
 public function action_validelogadm()
 {
     if ($this->req->log and $this->req->mdp) {
         if ($this->req->log != 'admin') {
             $f = $this->session->formlogadm;
             $f->populate();
             $this->session->formlogadm = $f;
             $this->site->ajouter_message("Login ou mot de passe incorrect");
             Site::redirect('login', 'logadmin');
         } else {
             $am = new AdminManager(DB::get_instance());
             $adm = $am->connexion($this->req->mdp);
             if ($adm) {
                 $this->session->ouvrir('admin');
                 $this->site->ajouter_message("Bienvenue Admin");
                 unset($this->session->formlogadm);
                 Site::redirect('admSpace');
             } else {
                 $f = $this->session->formlogadm;
                 $f->populate();
                 $this->session->formlogadm = $f;
                 $this->site->ajouter_message("Login ou mot de passe incorrect");
                 Site::redirect('login', 'logadmin');
             }
         }
     } else {
         $this->site->ajouter_message("Login ou mot de passe non renseigné");
         Site::redirect("login", "logadm");
     }
 }
 private function getOnlineAdminsEmails()
 {
     $adminManager = AdminManager::getInstance(null, null);
     $adminsDtos = $adminManager->selectAll();
     $onlineUsersManager = OnlineUsersManager::getInstance(null, null);
     $ret = array();
     foreach ($adminsDtos as $adminDto) {
         $adminEmail = $adminDto->getEmail();
         $onlineAdminDto = $onlineUsersManager->selectByField('email', $adminEmail);
         if (!empty($onlineAdminDto)) {
             $ret[] = $adminEmail;
         }
     }
     return $ret;
 }
Exemple #29
0
 public function getLanguage($bObject = false)
 {
     $sResult = $this->getAttribute(self::SESSION_LANGUAGE_KEY);
     if ($bObject) {
         $sResult = LanguageQuery::create()->findPk($sResult);
         if (!$sResult) {
             //If an object was explicitly requested, most likely, it’s supposed to be a content language
             $sResult = LanguageQuery::create()->findPk(AdminManager::getContentLanguage());
         }
     }
     return $sResult;
 }
Exemple #30
0
 /**
  * @deprecated moved to AdminManager::createLanguageIfNoneExist(), is only used in admin context
  */
 public static function createLanguageIfNoneExist($sLanguage)
 {
     AdminManager::createLanguageIfNoneExist($sLanguage);
 }