function publicAdminManager_list()
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.table.php';
    $lang =& DoceboLanguage::createInstance('adminrules', 'framework');
    $lang =& DoceboLanguage::createInstance('public_admin_manager', 'framework');
    $aclManager = new DoceboACLManager();
    // get users to show --------------------------------------------------
    $admin_group_idst = $aclManager->getGroupST(ADMIN_GROUP_PUBLICADMIN);
    $arr_admin_idst = $aclManager->getGroupUMembers($admin_group_idst);
    $arr_admin_id = array_flip($aclManager->getArrUserST($arr_admin_idst));
    $pm =& PlatformManager::createInstance();
    $lms_is_active = $pm->isLoaded("lms");
    /*$cms_is_active = $pm->isLoaded("cms");*/
    // print table --------------------------------------------------------
    $table = new Table(Get::sett('visuItem'), $lang->def('_PUBLIC_ADMIN_USER'), $lang->def('_PUBLIC_ADMIN_USER'));
    $table->initNavBar('ini', 'link');
    $table->setLink('index.php?modname=public_admin_manager&op=view&ini=');
    $ini = $table->getSelectedElement();
    $GLOBALS['page']->add(getTitleArea($lang->def('_ADMIN_MANAGMENT'), 'admin_managmer', $lang->def('_ADMIN_MANAGMENT')) . '<div class="std_block">', 'content');
    $contentH = array($lang->def('_USERNAME'), '<img src="' . getPathImage() . 'admin_manager/man_pref.gif" alt="' . $lang->def('_ADMIN_PREFERENCES_TITLE', 'adminrules') . '" ' . 'title="' . $lang->def('_ADMIN_PREFERENCES_TITLE', 'adminrules') . '" />', '<img src="' . getPathImage() . 'admin_manager/man_menu.gif" alt="' . $lang->def('_ASSIGN_USERS', 'adminrules') . '" ' . 'title="' . $lang->def('_ASSIGN_USERS', 'adminrules') . '" />', '<img src="' . getPathImage() . 'directory/tree.gif" alt="' . $lang->def('_ASSIGN_USERS', 'adminrules') . '" ' . 'title="' . $lang->def('_ASSIGN_USERS', 'adminrules') . '" />');
    $typeH = array('', 'image', 'image', 'image');
    if ($lms_is_active) {
        $contentH[] = '<img src="' . getPathImage() . 'admin_manager/man_course.gif" alt="' . $lang->def('_ASSIGN_USERS', 'adminrules') . '" ' . 'title="' . $lang->def('_ASSIGN_USERS', 'adminrules') . '" />';
        $typeH[] = 'image';
    }
    $table->setColsStyle($typeH);
    $table->addHead($contentH);
    $maxItem = count($arr_admin_id) < $ini + Get::sett('visuItem') ? count($arr_admin_id) : $ini + Get::sett('visuItem');
    for ($index = $ini; $index < $maxItem; $index++) {
        $admin_userid = substr($arr_admin_id[$arr_admin_idst[$index]], 1);
        $rowContent = array($admin_userid);
        // Edit preferences
        $rowContent[] = '<a href="index.php?modname=public_admin_manager&amp;op=edit_preferences&amp;adminidst=' . $arr_admin_idst[$index] . '"
						 title="' . $lang->def('_ADMIN_PREFERENCES_TITLE', 'adminrules') . ' : ' . $admin_userid . '">' . '<img src="' . getPathImage() . 'admin_manager/man_pref.gif"' . ' alt="' . $lang->def('_ADMIN_PREFERENCES_TITLE', 'adminrules') . ' : ' . $admin_userid . '" /></a>';
        // Edit menu
        $rowContent[] = '<a href="index.php?modname=public_admin_manager&amp;op=edit_menu&amp;adminidst=' . $arr_admin_idst[$index] . '"
						 title="' . $lang->def('_ASSIGN_USERS', 'adminrules') . ' : ' . $admin_userid . '">' . '<img src="' . getPathImage() . 'admin_manager/man_menu.gif"' . ' alt="' . $lang->def('_ASSIGN_USERS', 'adminrules') . ' : ' . $admin_userid . '" /></a>';
        // Edit user
        $rowContent[] = '<a href="index.php?modname=public_admin_manager&amp;op=assign_tree&amp;adminidst=' . $arr_admin_idst[$index] . '"
		 					title="' . $lang->def('_ASSIGN_USERS', 'adminrules') . ' : ' . $admin_userid . '">' . '<img src="' . getPathImage() . 'directory/tree.gif" ' . 'alt="' . $lang->def('_ASSIGN_USERS', 'adminrules') . ' : ' . $admin_userid . '" /></a>';
        // Edit course
        if ($lms_is_active) {
            $rowContent[] = '<a href="index.php?modname=public_admin_manager&amp;op=edit_course&amp;adminidst=' . $arr_admin_idst[$index] . '&amp;load=1"
								 title="' . $lang->def('_ASSIGN_USERS', 'adminrules') . ' : ' . $admin_userid . '">' . '<img src="' . getPathImage() . 'admin_manager/man_course.gif"' . ' alt="' . $lang->def('_ASSIGN_USERS', 'adminrules') . ' : ' . $admin_userid . '" /></a>';
        }
        $table->addBody($rowContent);
    }
    $GLOBALS['page']->add($table->getTable() . $table->getNavBar($ini, count($arr_admin_id)), 'content');
    $GLOBALS['page']->add('</div>', 'content');
}
Example #2
0
function canAccessCmsMedia()
{
    require_once _base_ . '/lib/lib.platform.php';
    $pl =& PlatformManager::createInstance();
    if (!$pl->isLoaded('cms')) {
        return false;
    }
    $level_id = Docebo::user()->getUserLevelId();
    if (Docebo::user()->isAnonymous()) {
        return false;
    }
    if ($GLOBALS["htmledit_image_godadmin"] && $level_id == ADMIN_GROUP_GODADMIN || $GLOBALS["htmledit_image_admin"] && $level_id == ADMIN_GROUP_ADMIN || $GLOBALS["htmledit_image_user"] && $level_id == ADMIN_GROUP_USER) {
        if ($GLOBALS["where_cms"] === false || $GLOBALS["where_cms_relative"] === false) {
            return false;
        } else {
            return true;
        }
    } else {
        return false;
    }
}
Example #3
0
 function _saveSuiteManager()
 {
     require_once _base_ . '/lib/lib.platform.php';
     $plat_man =& PlatformManager::createInstance();
     $all_platform = $plat_man->getPlatformsInfo();
     $re = true;
     reset($all_platform);
     while (list($code, $info) = each($all_platform)) {
         if ($info['hidden_in_config'] != 'true') {
             $code = $info['platform'];
             if (isset($_POST['activate_platform'][$code])) {
                 $re &= $plat_man->activatePlatform($code);
                 $code_list_home[$code] = $info['name'];
             } elseif ($info['mandatory'] == 'false') {
                 $re &= $plat_man->deactivatePlatform($code);
             }
         }
     }
     if (isset($code_list_home[$_POST['platform_in_home']])) {
         $re &= $plat_man->putInHome($_POST['platform_in_home']);
     }
     return $re;
 }
 function getUserGroupsList($viewer = false)
 {
     if ($viewer !== false) {
         $this->setViewer($viewer);
     }
     require_once _base_ . '/lib/lib.platform.php';
     $pl_man =& PlatformManager::CreateInstance();
     if ($pl_man->isLoaded('lms')) {
         $user_groups = $this->_up_data_man->getUserGroupsList($this->_id_user);
         return $this->_up_viewer->getUserGroupsList($user_groups);
     }
     return '';
 }
Example #5
0
 /**
  * @return string with the default region_id in system
  */
 function getDefaultRegion()
 {
     require_once _base_ . '/lib/lib.platform.php';
     $plt_man =& PlatformManager::createInstance();
     $def_lang = $plt_man->getLanguageForPlatform();
     if ($this->default_region == NULL || $this->default_region == "") {
         $qtxt = "SELECT region_id FROM " . $this->_getListTable() . " WHERE lang_code='" . $def_lang . "'";
         $q = $this->_executeQuery($qtxt);
         if ($q && mysql_num_rows($q) > 0) {
             $row = mysql_fetch_array($q);
             $this->default_region = $row["region_id"];
         } else {
             $this->default_region = 'english';
         }
     }
     return $this->default_region;
 }
Example #6
0
 /**
  * @param    string $language the language to use as filter
  * @param    array $array_idst the  optional security token of the users to be
  *                                    used as an additional filter
  *
  * @return    array    with user idst of the found entries
  */
 function getUsersIdstByLanguage($language, $array_idst = FALSE)
 {
     require_once _base_ . '/lib/lib.platform.php';
     $plat_man =& PlatformManager::createInstance();
     if ($language == $plat_man->getLanguageForPlatform()) {
         $get_null = TRUE;
     } else {
         $get_null = FALSE;
     }
     $lang_idst_arr = $this->getUsersBySetting("ui.language", $language, $get_null, $array_idst);
     return $lang_idst_arr;
 }
Example #7
0
function maskModCourse(&$course, $new = false, $name_category = '')
{
    require_once $GLOBALS['where_lms'] . '/lib/lib.course.php';
    $out =& $GLOBALS['page'];
    $out->setWorkingZone('content');
    $form = new Form();
    $classroom = false;
    if (isset($_GET['type']) && $_GET['type'] === 'classroom') {
        $classroom = true;
    }
    //addAjaxJs();
    YuiLib::load();
    $lang =& DoceboLanguage::CreateInstance('course', 'lms');
    $levels = CourseLevel::getLevels();
    $array_lang = Docebo::langManager()->getAllLangCode();
    $array_lang[] = 'none';
    //status of course -----------------------------------------------------
    $status = array(CST_PREPARATION => $lang->def('_CST_PREPARATION'), CST_AVAILABLE => $lang->def('_CST_AVAILABLE'), CST_EFFECTIVE => $lang->def('_CST_CONFIRMED'), CST_CONCLUDED => $lang->def('_CST_CONCLUDED'), CST_CANCELLED => $lang->def('_CST_CANCELLED'));
    //difficult ------------------------------------------------------------
    $difficult_lang = array('veryeasy' => $lang->def('_DIFFICULT_VERYEASY'), 'easy' => $lang->def('_DIFFICULT_EASY'), 'medium' => $lang->def('_DIFFICULT_MEDIUM'), 'difficult' => $lang->def('_DIFFICULT_DIFFICULT'), 'verydifficult' => $lang->def('_DIFFICULT_VERYDIFFICULT'));
    //type of course -------------------------------------------------------
    $course_type = array('elearning' => $lang->def('_COURSE_TYPE_ELEARNING'), 'blended' => $lang->def('_COURSE_TYPE_BLENDED'), 'classroom' => $lang->def('_CLASSROOM'));
    // points policy -------------------------------------------------------
    $show_who_online = array(0 => $lang->def('_DONT_SHOW'), _SHOW_COUNT => $lang->def('_SHOW_COUNT'), _SHOW_INSTMSG => $lang->def('_SHOW_INSTMSG'));
    if ($new == true) {
        // menu availables -----------------------------------------------------
        $menu_custom = getAllCustom();
        list($sel_custom) = current($menu_custom);
        reset($menu_custom);
    }
    $out->add($form->openElementSpace());
    if ($new == true) {
        $out->add($form->getLineBox($lang->def('_CATEGORY_SELECTED'), $name_category));
    } else {
        $out->add($form->getDropdown($lang->def('_CATGORY'), 'idCategory', 'idCategory', getCategoryForDropdown(), $course['idCategory']));
    }
    require_once _lms_ . '/admin/models/LabelAlms.php';
    $label_model = new LabelAlms();
    $out->add($form->getTextfield($lang->def('_CODE'), 'course_code', 'course_code', '50', $course['code']) . $form->getTextfield($lang->def('_COURSE_NAME'), 'course_name', 'course_name', '255', $course['name']) . $form->getDropdown($lang->def('_COURSE_LANG_METHOD'), 'course_lang', 'course_lang', $array_lang, array_search($course['lang_code'], $array_lang)) . $form->getDropdown($lang->def('_DIFFICULTY'), 'course_difficult', 'course_difficult', $difficult_lang, $course['difficult']) . ($classroom ? $form->getHidden('course_type', 'course_type', 'classroom') : $form->getDropdown($lang->def('_COURSE_TYPE'), 'course_type', 'course_type', $course_type, $course['course_type'])) . $form->getDropdown($lang->def('_STATUS'), 'course_status', 'course_status', $status, $course['status']) . $form->getDropdown($lang->def('_LABEL'), 'label', 'label', $label_model->getLabelFromDropdown(true), $new ? false : $label_model->getCourseLabel($course['idCourse'])) . ($classroom ? '' : $form->getCheckbox($lang->def('_COURSE_EDITION'), 'course_edition_yes', 'course_edition', 1, $course['course_edition'] == 1)) . ($new == true ? $form->getDropdown($lang->def('_COURSE_MENU_TO_ASSIGN'), 'selected_menu', 'selected_menu', $menu_custom, $sel_custom) : '') . $form->getCheckbox($lang->def('_DIRECT_PLAY'), 'direct_play', 'direct_play', '1', $course['direct_play'] == 1) . $form->getCheckbox($lang->def('_SHOW_RESULTS'), 'show_result', 'show_result', '1', $course['show_result'] == 1) . $form->getTextarea($lang->def('_DESCRIPTION'), 'course_descr', 'course_descr', $course['description']) . '<div class="align_center">' . str_replace('[down]', '', $lang->def('_COURSE_MORE_OPTION')) . '</div>' . (!$new && !$classroom ? $form->getCheckbox($lang->def('_CASCADE_MOD_ON_EDITION'), 'cascade_on_ed', 'cascade_on_ed', 1) : '') . $form->closeElementSpace() . $form->openElementSpace() . $form->getOpenFieldset($lang->def('_COURSE_SUBSCRIPTION')) . $form->getOpenCombo($lang->def('_USER_CAN_SUBSCRIBE')) . $form->getRadio($lang->def('_SUBSCRIPTION_CLOSED'), 'subscription_closed', 'can_subscribe', '0', $course['can_subscribe'] == 0) . $form->getRadio($lang->def('_SUBSCRIPTION_OPEN'), 'subscription_open', 'can_subscribe', '1', $course['can_subscribe'] == 1) . $form->getRadio($lang->def('_SUBSCRIPTION_IN_PERIOD') . ":", 'subscription_period', 'can_subscribe', '2', $course['can_subscribe'] == 2) . $form->getCloseCombo() . $form->getDatefield($lang->def('_SUBSCRIPTION_DATE_BEGIN') . ":", 'sub_start_date', 'sub_start_date', $course['sub_start_date']) . $form->getDatefield($lang->def('_SUBSCRIPTION_DATE_END') . ":", 'sub_end_date', 'sub_end_date', $course['sub_end_date']) . $form->getBreakRow() . $form->getTextfield($lang->def('_COURSE_AUTOREGISTRATION_CODE'), 'course_autoregistration_code', 'course_autoregistration_code', '255', $course['autoregistration_code']) . $form->getCheckbox($lang->def('_RANDOM_COURSE_AUTOREGISTRATION_CODE'), 'random_course_autoregistration_code', 'random_course_autoregistration_code', 0) . $form->getCloseFieldset() . $form->getOpenFieldset($lang->def('_COURSE_DISPLAY_MODE')) . $form->getOpenCombo($lang->def('_WHERE_SHOW_COURSE')) . $form->getRadio($lang->def('_SC_EVERYWHERE'), 'course_show_rules_every', 'course_show_rules', '0', $course['show_rules'] == 0) . $form->getRadio($lang->def('_SC_ONLY_IN'), 'course_show_rules_only_in', 'course_show_rules', '1', $course['show_rules'] == 1) . $form->getRadio($lang->def('_SC_ONLYINSC_USER'), 'course_show_rules_onlyinsc_user', 'course_show_rules', '2', $course['show_rules'] == 2) . $form->getCloseCombo() . $form->getOpenCombo($lang->def('_WHAT_SHOW')) . $form->getCheckbox($lang->def('_SHOW_PROGRESS'), 'course_progress', 'course_progress', '1', $course['show_progress'] == 1) . $form->getCheckbox($lang->def('_SHOW_TIME'), 'course_time', 'course_time', '1', $course['show_time'] == 1) . $form->getCheckbox($lang->def('_SHOW_ADVANCED_INFO'), 'course_advanced', 'course_advanced', '1', $course['show_extra_info'] == 1) . $form->getCloseCombo() . $form->getDropdown($lang->def('_SHOW_WHOISONLINE'), 'show_who_online', 'show_who_online', $show_who_online, $course['show_who_online']) . $form->getOpenCombo($lang->def('_SHOW_USER_OF_LEVEL')), 'content');
    while (list($level, $level_name) = each($levels)) {
        $out->add($form->getCheckbox($level_name, 'course_show_level_' . $level, 'course_show_level[' . $level . ']', $level, $course['level_show_user'] & 1 << $level));
    }
    $out->add($form->getCloseCombo() . $form->getCloseFieldset() . $form->getOpenFieldset($lang->def('_USER_INTERACTION_OPTION')) . $form->getOpenCombo($lang->def('_COURSE_SUBSRIBE')) . $form->getRadio($lang->def('_COURSE_S_GODADMIN'), 'course_subs_godadmin', 'course_subs', '0', $course['subscribe_method'] == 0) . $form->getRadio($lang->def('_COURSE_S_MODERATE'), 'course_subs_moderate', 'course_subs', '1', $course['subscribe_method'] == 1) . $form->getRadio($lang->def('_COURSE_S_FREE'), 'course_subs_free', 'course_subs', '2', $course['subscribe_method'] == 2) . $form->getCloseCombo());
    $pl_man =& PlatformManager::CreateInstance();
    if ($pl_man->isLoaded('ecom') || 1) {
        $out->add($form->getCheckbox($lang->def('_COURSE_SELL'), 'course_sell', 'course_sell', '1', $course['selling'] == 1) . $form->getTextfield($lang->def('_COURSE_PRIZE'), 'course_prize', 'course_prize', '11', $course['prize']) . $form->getTextfield($lang->def('_COURSE_ADVANCE'), 'advance', 'advance', '11', $course['advance']));
    } else {
        $out->add($form->getHidden('course_prize', 'course_prize', '0') . $form->getHidden('advance', 'advance', '0'));
    }
    // mode for course end--------------------------------------------
    $out->add($form->getHidden('course_em', 'course_em', '0') . $form->getOpenCombo($lang->def('_COURSE_STATUS_CANNOT_ENTER')) . $form->getCheckbox($lang->def('_USER_STATUS_SUBS'), 'user_status_' . _CUS_SUBSCRIBED, 'user_status[' . _CUS_SUBSCRIBED . ']', _CUS_SUBSCRIBED, $course['userStatusOp'] & 1 << _CUS_SUBSCRIBED) . $form->getCheckbox($lang->def('_USER_STATUS_BEGIN'), 'user_status_' . _CUS_BEGIN, 'user_status[' . _CUS_BEGIN . ']', _CUS_BEGIN, $course['userStatusOp'] & 1 << _CUS_BEGIN) . $form->getCheckbox($lang->def('_USER_STATUS_END'), 'user_status_' . _CUS_END, 'user_status[' . _CUS_END . ']', _CUS_END, $course['userStatusOp'] & 1 << _CUS_END) . $form->getCheckbox($lang->def('_USER_STATUS_SUSPEND'), 'user_status_' . _CUS_SUSPEND, 'user_status[' . _CUS_SUSPEND . ']', _CUS_SUSPEND, $course['userStatusOp'] & 1 << _CUS_SUSPEND) . $form->getCloseCombo() . $form->getCloseFieldset());
    //-expiration---------------------------------------------------------
    $hours = array('-1' => '- -', '0' => '00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23');
    $quarter = array('-1' => '- -', '00' => '00', '15' => '15', '30' => '30', '45' => '45');
    if ($course['hour_begin'] != '-1') {
        $hb_sel = (int) substr($course['hour_begin'], 0, 2);
        $qb_sel = substr($course['hour_begin'], 3, 2);
    } else {
        $hb_sel = $qb_sel = '-1';
    }
    if ($course['hour_end'] != '-1') {
        $he_sel = (int) substr($course['hour_end'], 0, 2);
        $qe_sel = substr($course['hour_end'], 3, 2);
    } else {
        $he_sel = $qe_sel = '-1';
    }
    /*
    	$out->add(
    		'<script type="text/javascript">'
    		."
    		alert(cal_course_date_begin);
    		cal_course_date_begin.onUpdate = function() {
    			var new_date = \$F('course_date_begin');
    			\$('course_date_end').value = new_date;
    		}
    
    
    		"
    		.'</script>'
    	, 'footer');*/
    $out->add($form->getOpenFieldset($lang->def('_COURSE_TIME_OPTION')) . $form->getDatefield($lang->def('_DATE_BEGIN'), 'course_date_begin', 'course_date_begin', $course['date_begin']) . $form->getDatefield($lang->def('_DATE_END'), 'course_date_end', 'course_date_end', $course['date_end']) . $form->getLineBox('<label for="hour_begin_hour">' . $lang->def('_HOUR_BEGIN') . '</label>', $form->getInputDropdown('dropdown_nw', 'hour_begin_hour', 'hour_begin[hour]', $hours, $hb_sel, '') . ' : ' . $form->getInputDropdown('dropdown_nw', 'hour_begin_quarter', 'hour_begin[quarter]', $quarter, $qe_sel, '')) . $form->getLineBox('<label for="hour_end_hour">' . $lang->def('_HOUR_END') . '</label>', $form->getInputDropdown('dropdown_nw', 'hour_end_hour', 'hour_end[hour]', $hours, $he_sel, '') . ' : ' . $form->getInputDropdown('dropdown_nw', 'hour_end_quarter', 'hour_end[quarter]', $quarter, $qe_sel, '')) . $form->getTextfield($lang->def('_DAY_OF_VALIDITY'), 'course_day_of', 'course_day_of', '10', $course['valid_time']) . $form->getTextfield($lang->def('_MEDIUM_TIME'), 'course_medium_time', 'course_medium_time', '10', $course['mediumTime']) . $form->getCloseFieldset());
    //sponsor-and-logo----------------------------------------------------
    $out->add($form->getOpenFieldset($lang->def('_COURSE_SPECIAL_OPTION')) . $form->getTextfield($lang->def('_MIN_NUM_SUBSCRIBE'), 'min_num_subscribe', 'min_num_subscribe', '11', $course['min_num_subscribe']) . $form->getTextfield($lang->def('_MAX_NUM_SUBSCRIBE'), 'max_num_subscribe', 'max_num_subscribe', '11', $course['max_num_subscribe']) . $form->getCheckbox($lang->def('_ALLOW_OVERBOOKING'), 'allow_overbooking', 'allow_overbooking', '1', $course['allow_overbooking'] == 1) . $form->getTextfield($lang->def('_COURSE_QUOTA'), 'course_quota', 'course_quota', '11', $course['course_quota'] != COURSE_QUOTA_INHERIT ? $course['course_quota'] : 0) . $form->getCheckbox($lang->def('_INHERIT_QUOTA'), 'inherit_quota', 'inherit_quota', '1', $course['course_quota'] == COURSE_QUOTA_INHERIT) . $form->getCloseFieldset() . $form->getOpenFieldset($lang->def('_DOCUMENT_UPLOAD')));
    if ($new == true) {
        $out->add($form->getFilefield($lang->def('_USER_MATERIAL'), 'course_user_material', 'course_user_material') . $form->getFilefield($lang->def('_OTHER_USER_MATERIAL'), 'course_otheruser_material', 'course_otheruser_material') . $form->getTextfield($lang->def('_SPONSOR_LINK'), 'course_sponsor_link', 'course_sponsor_link', '255', $course['linkSponsor']) . $form->getFilefield($lang->def('_SPONSOR_LOGO'), 'course_sponsor_logo', 'course_sponsor_logo') . $form->getFilefield($lang->def('_COURSE_LOGO'), 'course_logo', 'course_logo') . $form->getFilefield($lang->def('_COURSE_DEMO'), 'course_demo', 'course_demo'));
    } else {
        $out->add($form->getExtendedFilefield($lang->def('_USER_MATERIAL'), 'course_user_material', 'course_user_material', $course["img_material"]) . $form->getExtendedFilefield($lang->def('_OTHER_USER_MATERIAL'), 'course_otheruser_material', 'course_otheruser_material', $course["img_othermaterial"]) . $form->getTextfield($lang->def('_SPONSOR_LINK'), 'course_sponsor_link', 'course_sponsor_link', '255', $course['linkSponsor']) . $form->getExtendedFilefield($lang->def('_SPONSOR_LOGO'), 'course_sponsor_logo', 'course_sponsor_logo', $course["imgSponsor"]) . $form->getExtendedFilefield($lang->def('_COURSE_LOGO'), 'course_logo', 'course_logo', $course["img_course"]) . $form->getExtendedFilefield($lang->def('_COURSE_DEMO'), 'course_demo', 'course_demo', $course["course_demo"]));
    }
    $out->add($form->getCheckbox($lang->def('_USE_LOGO_IN_COURSELIST'), 'use_logo_in_courselist', 'use_logo_in_courselist', 1, $course["use_logo_in_courselist"]) . $form->getCloseFieldset() . $form->closeElementSpace());
}
/**
 * @return array 0 => can_buy		=> user can put the course in the cart
 * 					can_prenote 	=> user can
 * 					can_subscribe 	=> user can subscribe freely
 * 					can_reserve		=> user can put the course in the buyer cart
 * 					can_overbook	=> user can put the course in the buyer cart, but in overbooking
 *
 * 					impossible 		=> the user can do nothing with the course
 * 					in_cart 		=> the course is in the user cart
 * 					subscribed 		=> user is alredy enrolled to the course
 *
 * 					waiting_admin 	=> alredy request subs. and waiting for admin approvation
 * 					waiting_buyer 	=> alredy request, waiting for buyer approvation
 * 					waiting_payment => waiting for payment confirmation
 * 					waiting_overbooking => in overbooking, cannot be approved
 *
 * 				1=> link for action
 * 				2=> associated icon
 * 				3=> if the subscrition is impossibile here you can find the problem
 *
 */
function relationWithCourse($id_course, &$course, $uc_details, $edition_id = false)
{
    // 	require_once($GLOBALS['where_ecom'].'/lib/lib.cart.php');
    // 	$cart =& Cart::createInstance();
    list($enrolled) = sql_fetch_row(sql_query("SELECT COUNT(*) FROM " . $GLOBALS['prefix_lms'] . "_courseuser WHERE idCourse = '" . $id_course . "' AND edition_id = '0'"));
    $course['enrolled'] = $enrolled;
    $base_link = 'index.php?modname=' . (Docebo::user()->isAnonymous() ? 'login' : 'coursecatalogue') . '&op=';
    $bought_items =& getEcomItems();
    $product_type = $edition_id !== FALSE ? "course_edition" : "course";
    $search_item = $edition_id !== FALSE ? $product_type . "_" . $edition_id : $product_type . "_" . $id_course;
    if ($uc_details != false) {
        // user is in relation with the course, alredy subscribed or waiting for admin approvation
        switch ($uc_details['waiting']) {
            case '0':
                return array('subscribed', false, false);
                break;
            case '1':
                return array('waiting_admin', false, false);
                break;
            case '2':
                return array('waiting_overbooking', false, false);
                break;
        }
    }
    switch ($course['can_subscribe']) {
        case "0":
            return array('impossible', false, false, 'subscribe_lock');
            break;
        case "2":
            $today = date("Y-m-d H:i:s");
            if ($course['sub_start_date'] != 'NULL' && strcmp($course['sub_start_date'], $today) > 0) {
                return array('impossible', false, false, 'date_range');
            }
            if ($course['sub_end_date'] != 'NULL' && strcmp($course['sub_end_date'], $today) < 0) {
                return array('impossible', false, false, 'date_range');
            }
            break;
    }
    if ($course['subscribe_method'] > 0) {
        $pl_man =& PlatformManager::CreateInstance();
        if (!$pl_man->isLoaded('ecom')) {
            $course['selling'] = 0;
        }
        if ($course['selling'] == 1) {
            $ecom_type = getPLSetting("ecom", "ecom_type", "none");
            if ($ecom_type == "standard") {
                // maybe if the course is with edition there is an editon in the cart
                if ($edition_id !== FALSE && isset($course['edition_list']) && !empty($course['edition_list'])) {
                    while (list($id) = each($course['edition_list'])) {
                        /*
                        						if(isset($bought_items['transaction'][$product_type]) && in_array($product_type."_".$id, $bought_items['transaction'][$product_type])) {
                        							// find in bought item
                        							return array('waiting_payment', false, false);
                        						} else*/
                        if ($cart->isInCart($product_type . "_" . $id)) {
                            // find in cart
                            return array('in_cart', false, false);
                        }
                    }
                    reset($course['edition_list']);
                } else {
                    /*if(isset($bought_items['transaction'][$product_type]) && in_array($search_item, $bought_items['transaction'][$product_type])) {
                    			// find in bought item
                    			return array('waiting_payment', false, false);
                    		} else*/
                    if ($cart->isInCart($search_item)) {
                        // find in cart
                        return array('in_cart', false, false);
                    }
                }
                // max number of subscription ? overbooking ? ---------------------------------------
                if ($course['max_num_subscribe'] != 0 && $course['max_num_subscribe'] <= $course['enrolled']) {
                    if ($course['allow_overbooking'] == 1) {
                        return array('can_overbook', $base_link . 'overbook&amp;id=' . $id_course, false);
                    } else {
                        return array('impossible', false, false, 'full_course');
                    }
                }
                return array('can_buy', $base_link . 'addToCart&id=' . $id_course, 'can_buy.png');
            } elseif ($ecom_type == "with_buyer") {
                // ecom is with buyer --------------------------------------------------------------------------
                // maybe if the course is with edition there is an editon in the cart
                if ($edition_id !== FALSE && isset($course['edition_list']) && !empty($course['edition_list'])) {
                    while (list($id) = each($course['edition_list'])) {
                        if (isset($bought_items['reservation'][$product_type]) && in_array($product_type . "_" . $id, $bought_items['reservation'][$product_type])) {
                            // find in bought item
                            return array('waiting_payment', false, false);
                        } elseif ($cart->isInCart($product_type . "_" . $id)) {
                            // find in cart
                            return array('in_cart', false, false);
                        }
                    }
                    reset($course['edition_list']);
                } else {
                    // searching in the buyer assigned to the user the course
                    if (isset($bought_items['reservation'][$product_type]) && in_array($search_item, $bought_items['reservation'][$product_type])) {
                        return array('waiting_buyer', false, false);
                    } elseif ($cart->isInCart($search_item)) {
                        // find in cart
                        return array('in_cart', false, false);
                    }
                }
                // max number of subscription ? overbooking ? ---------------------------------------
                if ($course['max_num_subscribe'] != 0 && $course['max_num_subscribe'] <= $course['enrolled']) {
                    if ($course['allow_overbooking'] == 1) {
                        return array('can_overbook', $base_link . 'overbook&amp;id=' . $id_course, false);
                    } else {
                        return array('impossible', false, false, 'full_course');
                    }
                }
                return array('can_reserve', $base_link . 'reserve&amp;id=' . $id_course, 'can_prenote.png');
            }
        } else {
            if ($course['subscribe_method'] == 1) {
                // max number of subscription ? overbooking ? ---------------------------------------
                if ($course['max_num_subscribe'] != 0 && $course['max_num_subscribe'] <= $course['enrolled']) {
                    if ($course['allow_overbooking'] == 1) {
                        return array('can_overbook', false, false);
                    } else {
                        return array('impossible', false, false, 'full_course');
                    }
                }
                return array('can_prenote', $base_link . 'subscribecourse&amp;id=' . $id_course, 'can_prenote.png');
            }
            if ($course['subscribe_method'] == 2) {
                // max number of subscription ? overbooking ? ---------------------------------------
                if ($course['max_num_subscribe'] != 0 && $course['max_num_subscribe'] <= $course['enrolled']) {
                    if ($course['allow_overbooking'] == 1) {
                        return array('can_overbook', false, false);
                    } else {
                        return array('impossible', false, false, 'full_course');
                    }
                }
                return array('can_subscribe', $base_link . 'subscribecourse&amp;id=' . $id_course, 'can_subscribe.png');
            }
        }
    }
    return array('impossible', false, false, 'only_admin');
}
Example #9
0
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 menu()
 {
     require_once _base_ . '/lib/lib.platform.php';
     if (isset($_POST['back'])) {
         Util::jump_to('index.php?r=adm/adminrules/show');
     }
     $idst = Get::req('idst', DOTY_INT, 0);
     $active_tab = Get::req('active_tab', DOTY_MIXED, 'framework');
     $pm =& PlatformManager::createInstance();
     $platform_list = $pm->getPlatformList();
     if (isset($platform_list['scs'])) {
         unset($platform_list['scs']);
     }
     if (isset($platform_list['ecom'])) {
         unset($platform_list['ecom']);
     }
     $result_message = "";
     if (isset($_POST['save'])) {
         $adm_perm = array();
         if (isset($_POST['adm_perm'])) {
             $adm_perm = array_keys($_POST['adm_perm']);
         }
         $res = $this->model->saveAdminPerm($idst, $adm_perm);
         $result_message = $res ? UIFeedback::info(Lang::t('_OPERATION_SUCCESSFUL', 'standard')) : UIFeedback::error(Lang::t('_OPERATION_FAILURE', 'standard'));
         Util::jump_to('index.php?r=adm/adminrules/show&res=' . ($res ? 'ok' : 'err'));
     }
     $this->render('menu', array('idst' => $idst, 'platform_list' => $platform_list, 'active_tab' => $active_tab, 'model' => $this->model, 'save_res' => $result_message));
 }
Example #11
0
function isPlatformActive($platform)
{
    $pl_man =& PlatformManager::CreateInstance();
    $res = $pl_man->isLoaded($platform);
    return $res;
}
Example #12
0
/**
 * Return a specific setting from a platform
 * @param string $platform the code of the platform
 * @param string $param_name the name of the value
 * @param string $default the default value to return if noone is found
 * @return mixed the param required
 */
function getPLSetting($platform, $param_name, $default = FALSE)
{
    require_once _base_ . "/lib/lib.platform.php";
    $pl_man =& PlatformManager::CreateInstance();
    $res = $default;
    if ($pl_man->isLoaded($platform)) {
        /*
        if(!defined("LMS")) Util::load_setting(Get::cfg('prefix_lms').'_setting', 'lms');
        elseif(!defined("CMS")) Util::load_setting(Get::cfg('prefix_cms').'_setting', 'cms');
        elseif(!defined("SCS")) Util::load_setting(Get::cfg('prefix_scs').'_setting', 'scs');
        */
        $res = Get::sett($param_name);
    }
    return $res;
}
 public function multimodTask()
 {
     if (!$this->permissions['mod_user']) {
         $output = array('success' => false, 'message' => $this->_getErrorMessage('no permission'));
         echo $this->json->encode($output);
         return;
     }
     $title = Lang::t('_MOD', 'admin_directory');
     $users_count = Get::req('users_count', DOTY_INT, 0);
     if ($users_count <= 0) {
         $output = array('success' => true, 'header' => $title, 'body' => Lang::t('_EMPTY_SELECTION', 'admin_directory'));
         echo $this->json->encode($output);
         return;
     }
     $acl_man = Docebo::user()->getAclManager();
     $level = ADMIN_GROUP_USER;
     $arr_levels = $acl_man->getAdminLevels();
     //index = idst; value = groupid;
     $levels = array();
     foreach ($arr_levels as $groupid_level => $idst_level) {
         $levels[$groupid_level] = Lang::t('_DIRECTORY_' . $groupid_level, 'admin_directory');
     }
     $info = array('firstname' => '', 'lastname' => '', 'email' => '', 'level' => '', 'facebook_id' => '', 'twitter_id' => '', 'linkedin_id' => '', 'google_id' => '');
     $language = getDefaultLanguage();
     $languages = Docebo::langManager()->getAllLanguages();
     require_once _base_ . '/lib/lib.platform.php';
     $pman =& PlatformManager::createInstance();
     // = new PlatformManager();
     $platforms = $pman->getPlatformList();
     require_once _adm_ . '/lib/lib.field.php';
     $fman = new FieldList();
     $field_list = $fman->getFlatAllFields(array_keys($platforms));
     $fields_to_exclude = $fman->getFieldsByType('upload');
     $preference = new UserPreferences(0);
     $modify_mask = $preference->getModifyMask('ui.', true, true);
     $fields_mask = $fman->playFieldsForUser(-1, false, false, true, false, true);
     //build edit mask
     $this->render('multimod', array('users_count' => $users_count, 'title' => $title, 'levels' => $levels, 'modify_mask' => $modify_mask, 'fields_mask' => $fields_mask, 'fields_to_exclude' => is_array($fields_to_exclude) ? $fields_to_exclude : array(), 'info' => $info, 'json' => $this->json));
 }
Example #14
0
 function getLangStat()
 {
     require_once _base_ . '/lib/lib.platform.php';
     $pl_man =& PlatformManager::createInstance();
     $platform_list = array_keys($pl_man->getActivePlatformList());
     $stats = array();
     $lang_stat = "" . " SELECT COUNT(*)" . " FROM " . $this->_getTableText() . " " . " WHERE 0 ";
     foreach ($platform_list as $plat) {
         $lang_stat .= " OR text_platform = '" . $plat . "' ";
     }
     list($stats['tot_lang']) = sql_fetch_row(sql_query($lang_stat));
     $lang_stat = "" . "SELECT lang_code, COUNT(*) " . "FROM " . $this->_getTableTranslation() . " " . "WHERE translation_text <> '' " . "GROUP BY lang_code";
     $re_stat = sql_query($lang_stat);
     while (list($lc, $tot) = sql_fetch_row($re_stat)) {
         $stats[$lc] = $tot;
     }
     return $stats;
 }
 public function __construct($platform_params = null)
 {
     parent::__construct();
     $this->platform_handler = new ThinkSns($this->sig_api_key, $this->sig_secret);
     $this->platform_handler->api_client->set_session_key($platform_params['sig_session_key']);
     $this->sig_user = $platform_params['sig_user'];
 }
Example #16
0
     if (!Docebo::user()->isAnonymous() && isset($_SESSION['idCourse'])) {
         TrackUser::setActionTrack(getLogUserId(), $_SESSION['idCourse'], '', '');
     }
     //i need to save the language of the user in order to use it again after logout
     $language = Lang::get();
     if (!Docebo::user()->isAnonymous()) {
         TrackUser::logoutSessionCourseTrack();
         $_SESSION = array();
         session_destroy();
         // load standard language module and put it global
         $glang =& DoceboLanguage::createInstance('standard', 'framework');
         // Recreate Anonymous user
         $GLOBALS['current_user'] =& DoceboUser::createDoceboUserFromSession('public_area');
         $GLOBALS['logout'] = true;
         require_once _base_ . '/lib/lib.platform.php';
         $pm =& PlatformManager::createInstance();
         $pm->doCommonOperations("logout");
     }
     $GLOBALS['op'] = 'login';
     $GLOBALS['modname'] = 'login';
     $query = 'logout=1&special=changelang&new_lang=' . $language;
     if (isset($_GET['msg']) && !empty($_GET['msg'])) {
         $query = 'msg=' . (int) $_GET['msg'];
     }
     Util::jump_to('../index.php?' . $query);
     break;
 case "aula":
     require_once $GLOBALS['where_lms'] . '/lib/lib.course.php';
     if (!logIntoCourse($_GET['idCourse'], true)) {
         $_SESSION['current_main_menu'] = '1';
         $_SESSION['sel_module_id'] = '1';
Example #17
0
 function getShowOnPlatformFieldset($show_on_platform = FALSE)
 {
     $res = "";
     if ($this->canSelectPlatform()) {
         if ($show_on_platform === FALSE) {
             $show_on_platform = $this->getShowOnPlatformDefaultArr();
         }
         $plt_man =& PlatformManager::createInstance();
         $plt_list = $plt_man->getPlatformList(true);
         $res .= Form::getOpenFieldset(Lang::t('_SHOW_ON_PLATFORM', 'field'));
         $res .= Form::getHidden('show_on_platform_framework', 'show_on_platform[framework]', 1);
         while (list($code, $name) = each($plt_list)) {
             $sel = isset($show_on_platform[$code]) ? TRUE : FALSE;
             $res .= Form::getCheckbox($name, 'show_on_platform_' . $code, 'show_on_platform[' . $code . ']', 1, $sel);
         }
         $res .= Form::getCloseFieldset();
     } else {
         $res .= Form::getHidden('show_on_platform_framework', 'show_on_platform[framework]', 1);
         foreach ($this->getShowOnPlatformDefaultArr() as $code) {
             $res .= Form::getHidden('show_on_platform_' . $code, 'show_on_platform[' . $code . ']', 1);
         }
     }
     return $res;
 }
Example #18
0
 function org_waitingUser()
 {
     checkPerm('approve_waiting_user', false, 'directory', 'framework');
     require_once _base_ . '/lib/lib.form.php';
     require_once $GLOBALS['where_framework'] . '/lib/lib.field.php';
     require_once _base_ . '/lib/lib.table.php';
     require_once _base_ . '/lib/lib.usermanager.php';
     if (isset($_POST['ok_waiting'])) {
         $user_man = new UserManager();
         // Remove refused users
         $refused = array();
         $aopproved = array();
         if (isset($_POST['waiting_user_refuse'])) {
             while (list($idst) = each($_POST['waiting_user_refuse'])) {
                 $this->aclManager->deleteTempUser($idst, false, false, true);
             }
             $refused[] = $idst;
         }
         // Subscribed accepted users
         if (isset($_POST['waiting_user_accept'])) {
             $idst_usergroup = $this->aclManager->getGroup(false, ADMIN_GROUP_USER);
             $idst_usergroup = $idst_usergroup[ACL_INFO_IDST];
             $idst_oc = $this->aclManager->getGroup(false, '/oc_0');
             $idst_oc = $idst_oc[ACL_INFO_IDST];
             $idst_ocd = $this->aclManager->getGroup(false, '/ocd_0');
             $idst_ocd = $idst_ocd[ACL_INFO_IDST];
             $request = $this->aclManager->getTempUsers(false, true);
             while (list($idst) = each($_POST['waiting_user_accept'])) {
                 if ($this->aclManager->registerUser(addslashes($request[$idst]['userid']), addslashes($request[$idst]['firstname']), addslashes($request[$idst]['lastname']), $request[$idst]['pass'], addslashes($request[$idst]['email']), '', '', true, $idst)) {
                     $approved[] = $idst;
                     $this->aclManager->addToGroup($idst_usergroup, $idst);
                     $this->aclManager->addToGroup($idst_oc, $idst);
                     $this->aclManager->addToGroup($idst_ocd, $idst);
                     if ($request[$idst]['create_by_admin'] != 0) {
                         $pref = new UserPreferences($request[$idst]['create_by_admin']);
                         if ($pref->getAdminPreference('admin_rules.limit_user_insert') == 'on') {
                             $max_insert = $pref->getAdminPreference('admin_rules.max_user_insert');
                             $pref->setPreference('admin_rules.max_user_insert', $max_insert - 1);
                         }
                     }
                     $this->aclManager->deleteTempUser($idst, false, false, false);
                 }
             }
         }
         require_once _base_ . '/lib/lib.platform.php';
         require_once _base_ . '/lib/lib.eventmanager.php';
         // send the alert
         /*
         			if(!empty($refused)) {
         
         				$array_subst = array('[url]' => Get::sett('url'));
         
         				$msg_composer = new EventMessageComposer('admin_directory', 'framework');
         
         				$msg_composer->setSubjectLangText('email', '_REFUSED_USER_SBJ', false);
         				$msg_composer->setBodyLangText('email', '_REFUSED_USER_TEXT', $array_subst);
         
         				$msg_composer->setBodyLangText('sms', '_REFUSED_USER_TEXT_SMS', $array_subst);
         
         				createNewAlert(	'UserApproved', 'directory', 'edit', '1', 'Users refused',
         							$refused, $msg_composer );
         			}*/
         if (!empty($approved)) {
             $pl_man =& PlatformManager::createInstance();
             $array_subst = array('[url]' => Get::sett('url', ''));
             $msg_composer2 = new EventMessageComposer('admin_directory', 'framework');
             $msg_composer2->setSubjectLangText('email', '_APPROVED_USER_SBJ', false);
             $msg_composer2->setBodyLangText('email', '_APPROVED_USER_TEXT', $array_subst);
             $msg_composer2->setBodyLangText('sms', '_APPROVED_USER_TEXT_SMS', $array_subst);
             createNewAlert('UserApproved', 'directory', 'edit', '1', 'Users approved', $approved, $msg_composer2, true);
         }
         Util::jump_to('index.php?modname=directory&op=org_chart');
     } elseif (isset($_POST['cancel_waiting'])) {
         Util::jump_to('index.php?modname=directory&op=org_chart');
     } else {
         $tb = new Table(0, $this->lang->def('_WAITING_USERS'), $this->lang->def('_WAITING_USER_SUMMARY'));
         $type_h = array('', '', '', 'image', 'image');
         $cont_h = array($this->lang->def('_USERNAME'), $this->lang->def('_DIRECTORY_FULLNAME'), $this->lang->def('_BY'), '<img src="' . getPathImage('framework') . 'directory/wuser_accept.gif" alt="' . $this->lang->def('_ACCEPT') . '" ' . 'title="' . $this->lang->def('_ACCEPT_USER') . '" />', '<img src="' . getPathImage('framework') . 'directory/wuser_refuse.gif" alt="' . $this->lang->def('_REFUSE_USER') . '" ' . 'title="' . $this->lang->def('_REFUSE_USER_TITLE') . '" />');
         $tb->setColsStyle($type_h);
         $tb->addHead($cont_h);
         $temp_users = $this->aclManager->getTempUsers(false, true);
         if ($temp_users !== false) {
             $idst_admins = array();
             while (list($idst, $info) = each($temp_users)) {
                 if ($info['create_by_admin'] != 0) {
                     $idst_admins[] = $info['create_by_admin'];
                 }
             }
             $admins = $this->aclManager->getUsers($idst_admins);
             reset($temp_users);
             while (list($idst, $info) = each($temp_users)) {
                 if ($info['create_by_admin'] != 0) {
                     $creator = $admins[$info['create_by_admin']][ACL_INFO_LASTNAME] . ' ' . $admins[$info['create_by_admin']][ACL_INFO_FIRSTNAME];
                     if ($creator == '') {
                         $creator = $this->aclManager->relativeId($admins[$info['create_by_admin']][ACL_INFO_USERID]);
                     }
                 } else {
                     $creator = $this->lang->def('_DIRECOTRY_SELFREGISTERED');
                 }
                 $more = isset($_GET['id_user']) && $_GET['id_user'] == $idst ? '<a href="index.php?modname=directory&amp;op=org_waitinguser"><img src="' . getPathImage() . 'standard/less.gif"></a> ' : '<a href="index.php?modname=directory&amp;op=org_waitinguser&amp;id_user='******'"><img src="' . getPathImage() . 'standard/more.gif"></a> ';
                 $cont = array($more . $this->aclManager->relativeId($info['userid']), $info['lastname'] . ' ' . $info['firstname'], $creator, Form::getInputCheckbox('waiting_user_accept_' . $idst, 'waiting_user_accept[' . $idst . ']', $idst, false, '') . Form::getLabel('waiting_user_accept_' . $idst, $this->lang->def('_ACCEPT'), 'access-only'), Form::getInputCheckbox('waiting_user_refuse_' . $idst, 'waiting_user_refuse[' . $idst . ']', $idst, false, '') . Form::getLabel('waiting_user_refuse_' . $idst, $this->lang->def('_REFUSE_USER'), 'access-only'));
                 $tb->addBody($cont);
                 if (isset($_GET['id_user']) && $idst == $_GET['id_user']) {
                     $field = new FieldList();
                     $tb->addBodyExpanded($field->playFieldsForUser($idst, false, true), 'user_specific_info');
                 }
             }
         }
         $GLOBALS['page']->add(getTitleArea($this->lang->def('_WAITING_USERS'), 'directory') . '<div class="std_block">' . Form::openForm('waiting_user', 'index.php?modname=directory&amp;op=org_waitinguser') . $tb->getTable() . Form::openButtonSpace() . Form::getButton('ok_waiting', 'ok_waiting', $this->lang->def('_SAVE')) . Form::getButton('cancel_waiting', 'cancel_waiting', $this->lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm() . '</div>', 'content');
     }
 }
Example #19
0
<?php

defined("IN_FORMA") or die('Direct access is forbidden.');
/* ======================================================================== \
|   FORMA - The E-Learning Suite                                            |
|                                                                           |
|   Copyright (c) 2013 (Forma)                                              |
|   http://www.formalms.org                                                 |
|   License  http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt           |
|                                                                           |
|   from docebo 4.0.5 CE 2008-2012 (c) docebo                               |
|   License http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt            |
\ ======================================================================== */
if (Docebo::user()->isLoggedIn()) {
    $lang =& DoceboLanguage::createInstance('menu', 'framework');
    $p_man =& PlatformManager::createInstance();
    $platforms = $p_man->getPlatformList();
    cout('<li><a href="#main_menu">' . $lang->def('_BLIND_MAIN_MENU') . '</a></li>', 'blind_navigation');
    cout('<div id="main_menu_container" class="layout_menu_over yuimenubar yuimenubarnav">', 'menu_over');
    cout('<div class="bd"><ul class="first-of-type">', 'menu_over');
    foreach ($platforms as $p_code => $p_name) {
        $menu_man =& $p_man->getPlatofmMenuInstance($p_code);
        if ($menu_man !== false) {
            $main_voice = $menu_man->getLevelOne();
            if (!empty($main_voice)) {
                cout('<li class="yuimenuitem">' . '<a class="yuimenuitemlabel" href="#submenu_' . $p_code . '">' . '<span class="admmenu_' . $p_code . '">' . $lang->def('_FIRST_LINE_' . $p_code) . '</span>' . '</a>' . '<div id="submenu_' . $p_code . '" class="yuimenu"><div class="bd"><ul>', 'menu_over');
                foreach ($main_voice as $id_m => $v_main) {
                    $under_voice = $menu_man->getLevelTwo($id_m);
                    if (!isset($v_main['collapse']) || $v_main['collapse'] === false) {
                        cout('<li class="yuimenuitem">' . '<a class="yuimenuitemlabel" href="#submenu_' . $p_code . '_' . $id_m . '">' . $v_main['name'] . '</a>', 'menu_over');
                        if (!empty($under_voice)) {
Example #20
0
 function extendedParsing($arrayState, $arrayExpand, $arrayCompress)
 {
     if (isset($arrayState['editpersonsave'])) {
         $idst = $_POST['idst'];
         $userid = $_POST['userid'];
         $firstname = $_POST['firstname'];
         $lastname = $_POST['lastname'];
         $pass = $_POST['pass'];
         $userlevel = $_POST['userlevel'];
         $olduserlevel = $_POST['olduserlevel'];
         if ($pass === '') {
             $pass = FALSE;
         }
         $email = $_POST['email'];
         if ($idst !== '') {
             //-extra field-----------------------------------------------
             require_once $GLOBALS['where_framework'] . '/lib/lib.field.php';
             $fields = new FieldList();
             //$re_filled = $fields->isFilledFieldsForUser($idst);
             if ($userid != '') {
                 $info = $this->aclManager->getUser($idst, false);
                 $this->aclManager->updateUser($idst, $userid, $firstname, $lastname, $pass, $email, FALSE, FALSE);
                 //-extra field-----------------------------------------------
                 $fields->storeFieldsForUser($idst);
                 //-----------------------------------------------------------
                 // remove from old group level
                 $this->aclManager->removeFromGroup($olduserlevel, $idst);
                 // add to group level
                 $this->aclManager->addToGroup($userlevel, $idst);
                 if ($this->aclManager->absoluteId($userid) != $info[ACL_INFO_USERID] || $this->aclManager->encrypt($pass) != $info[ACL_INFO_PASS]) {
                     require_once _base_ . '/lib/lib.eventmanager.php';
                     $pl_man = PlatformManager::createInstance();
                     $array_subst = array('[url]' => Get::sett('url', ''), '[userid]' => $userid, '[password]' => $pass);
                     // message to user that is odified
                     $msg_composer = new EventMessageComposer();
                     $msg_composer->setSubjectLangText('email', '_MODIFIED_USER_SBJ', false);
                     $msg_composer->setBodyLangText('email', '_MODIFIED_USER_TEXT', $array_subst);
                     if ($pass != '') {
                         $msg_composer->setBodyLangText('email', '_PASSWORD_CHANGED', array('[password]' => $pass));
                     }
                     $msg_composer->setBodyLangText('sms', '_MODIFIED_USER_TEXT_SMS', $array_subst);
                     if ($pass != '') {
                         $msg_composer->setBodyLangText('sms', '_PASSWORD_CHANGED_SMS', array('[password]' => $pass));
                     }
                     createNewAlert('UserMod', 'directory', 'edit', '1', 'User ' . $userid . ' was modified', array($userid), $msg_composer);
                 }
                 $GLOBALS['page']->add(getResultUi($this->lang->def('_OPERATION_SUCCESSFUL')));
             } else {
                 $this->op = 'reedit_person';
                 //$GLOBALS['page']->add( getErrorUi( implode(',', $re_filled) ), 'content');
             }
         } else {
             if (isset($_POST['arr_idst_groups'])) {
                 $arr_idst_groups = unserialize(urldecode($_POST['arr_idst_groups']));
                 $acl =& Docebo::user()->getACL();
                 $arr_idst_all = $acl->getArrSTGroupsST($arr_idst_groups);
             } else {
                 $arr_idst_groups = FALSE;
                 $arr_idst_all = FALSE;
             }
             //-verify that userid is not already used
             if ($this->aclManager->getUserST($userid) !== FALSE) {
                 $GLOBALS['page']->add(getErrorUi($this->lang->def('_USERID_DUPLICATE')));
                 $_POST['userid'] = '';
                 $this->op = 'reedit_person';
             } else {
                 //-verify mandatory extra field--------------------------------
                 require_once $GLOBALS['where_framework'] . '/lib/lib.field.php';
                 $fields = new FieldList();
                 //$re_filled = $fields->isFilledFieldsForUser(0, $arr_idst_all);
                 if ($arr_idst_groups != FALSE && $userid != '') {
                     $idst = false;
                     if (Docebo::user()->getUserLevelId() != ADMIN_GROUP_GODADMIN) {
                         $limit_insert = Docebo::user()->preference->getAdminPreference('admin_rules.limit_user_insert');
                         $max_insert = Docebo::user()->preference->getAdminPreference('admin_rules.max_user_insert');
                         $direct_insert = Docebo::user()->preference->getAdminPreference('admin_rules.direct_user_insert');
                         if ($limit_insert == 'off' || $limit_insert == 'on' && $max_insert > 0) {
                             if ($direct_insert == 'on') {
                                 Docebo::user()->preference->setPreference('admin_rules.max_user_insert', $max_insert - 1);
                                 $idst = $this->aclManager->registerUser($userid, $firstname, $lastname, $pass, $email, '', '');
                                 require_once _base_ . '/lib/lib.preference.php';
                                 $preference = new UserPreferences($idst);
                                 $preference->savePreferences($_POST, 'ui.');
                                 require_once _base_ . "/lib/lib.eventmanager.php";
                                 $pl_man =& PlatformManager::createInstance();
                                 $array_subst = array('[url]' => Get::sett('url', ''), '[userid]' => $userid, '[password]' => $pass);
                                 // message to user that is inserted
                                 $msg_composer = new EventMessageComposer();
                                 $msg_composer->setSubjectLangText('email', '_REGISTERED_USER_SBJ', false);
                                 $msg_composer->setBodyLangText('email', '_REGISTERED_USER_TEXT', $array_subst);
                                 $msg_composer->setBodyLangText('sms', '_REGISTERED_USER_TEXT_SMS', $array_subst);
                                 createNewAlert('UserNew', 'directory', 'edit', '1', 'User ' . $userid . ' created', array($userid), $msg_composer);
                                 $GLOBALS['page']->add(getResultUi($this->lang->def('_INSERTED_NEW_USER')));
                             } else {
                                 $acl = Docebo::user()->getAcl();
                                 $idst = $this->aclManager->registerTempUser($userid, $firstname, $lastname, $pass, $email, 0, getLogUserId());
                                 require_once _base_ . "/lib/lib.eventmanager.php";
                                 $pl_man =& PlatformManager::createInstance();
                                 $array_subst = array('[url]' => Get::sett('url', ''), '[userid]' => $userid, '[password]' => $pass);
                                 // message to user that is waiting
                                 $msg_composer = new EventMessageComposer();
                                 $msg_composer->setSubjectLangText('email', '_WAITING_USER_SBJ', false);
                                 $msg_composer->setBodyLangText('email', '_WAITING_USER_TEXT', $array_subst);
                                 $msg_composer->setBodyLangText('sms', '_WAITING_USER_TEXT_SMS', $array_subst);
                                 // send message to the user subscribed
                                 createNewAlert('UserNew', 'directory', 'edit', '1', 'User ' . $userid . ' was modified', array($userid), $msg_composer);
                                 // set as recipients all who can approve a waiting user
                                 $msg_c_approve = new EventMessageComposer();
                                 $msg_c_approve->setSubjectLangText('email', '_TO_APPROVE_USER_SBJ', false);
                                 $msg_c_approve->setBodyLangText('email', '_TO_APPROVE_USER_TEXT', array('[url]' => Get::sett('url')));
                                 $msg_c_approve->setBodyLangText('sms', '_TO_APPROVE_USER_TEXT_SMS', array('[url]' => Get::sett('url')));
                                 $idst_approve = $acl->getRoleST('/framework/admin/directory/approve_waiting_user');
                                 $recipients = $this->aclManager->getAllRoleMembers($idst_approve);
                                 createNewAlert('UserNewModerated', 'directory', 'edit', '1', 'User ' . $userid . ' to moderate', $recipients, $msg_c_approve);
                                 $GLOBALS['page']->add(getResultUi($this->lang->def('_INSERTED_WAIT_FOR_ADMIN')));
                             }
                         }
                     } else {
                         $idst = $this->aclManager->registerUser($userid, $firstname, $lastname, $pass, $email, '', '');
                         require_once _base_ . '/lib/lib.preference.php';
                         $preference = new UserPreferences($idst);
                         $preference->savePreferences($_POST, 'ui.');
                         require_once _base_ . "/lib/lib.eventmanager.php";
                         $pl_man =& PlatformManager::createInstance();
                         $array_subst = array('[url]' => Get::sett('url', ''), '[userid]' => $userid, '[password]' => $pass);
                         // message to user that is inserted
                         $msg_composer = new EventMessageComposer();
                         $msg_composer->setSubjectLangText('email', '_REGISTERED_USER_SBJ', false);
                         $msg_composer->setBodyLangText('email', '_REGISTERED_USER_TEXT', $array_subst);
                         $msg_composer->setBodyLangText('sms', '_REGISTERED_USER_TEXT_SMS', $array_subst);
                         createNewAlert('UserNew', 'directory', 'edit', '1', 'User ' . $userid . ' created', array($idst), $msg_composer);
                     }
                     if ($idst !== false) {
                         foreach ($arr_idst_groups as $idst_group) {
                             $this->aclManager->addToGroup($idst_group, $idst);
                         }
                         // add to group level
                         $this->aclManager->addToGroup($userlevel, $idst);
                         //-save extra field------------------------------------------
                         $fields->storeFieldsForUser($idst, $arr_idst_all);
                         //-----------------------------------------------------------
                     }
                 } else {
                     $this->op = 'reedit_person';
                     //$GLOBALS['page']->add(getErrorUi(implode('<br/>', $re_filled)), 'content');
                 }
             }
         }
     } elseif (isset($arrayState['deleteperson'])) {
         $idst = $_POST['idst'];
         if ($idst !== '') {
             require_once _base_ . "/lib/lib.eventmanager.php";
             $u_info = $this->aclManager->getUser($idst, false);
             $userid = $u_info[ACL_INFO_USERID];
             $pl_man =& PlatformManager::createInstance();
             $acl_man =& Docebo::user()->getAclManager();
             $array_subst = array('[url]' => Get::sett('url', ''), '[userid]' => $acl_man->relativeId($userid));
             // message to user that is inserted
             $msg_composer = new EventMessageComposer();
             $msg_composer->setSubjectLangText('email', '_DELETED_USER_SBJ', false);
             $msg_composer->setBodyLangText('email', '_DELETED_USER_TEXT', $array_subst);
             $msg_composer->setBodyLangText('sms', '_DELETED_USER_TEXT_SMS', $array_subst);
             /*
             				createNewAlert(	'UserDel', 'directory', 'edit', '1', 'User '.$userid.' deleted',
             							array($idst), $msg_composer );*/
             $event =& DoceboEventManager::newEvent('UserDel', 'directory', 'edit', '1', 'User ' . addslashes($userid) . ' deleted');
             $event->setProperty('recipientid', implode(',', array($idst)));
             $event->setProperty('subject', $msg_composer->getSubject('email', getLanguage()));
             $event->setProperty('body', $msg_composer->getBody('email', getLanguage()));
             $msg_composer->prepare_serialize();
             $event->setProperty('MessageComposer', addslashes(rawurlencode(serialize($msg_composer))));
             $event->setProperty('userdeleted', $idst);
             DoceboEventManager::dispatch($event);
             $this->aclManager->deleteUser($idst);
             $GLOBALS['page']->add(getResultUi($this->lang->def('_OPERATION_SUCCESSFUL')));
         }
     }
     if (!isset($arrayState[$this->id])) {
         return;
     }
     foreach ($arrayState[$this->id] as $key => $action) {
         if ($key == 'save_newfolder') {
             $array_lang = Docebo::langManager()->getAllLangCode();
             $mand_lang = getLanguage();
             if (!isset($action[$mand_lang])) {
                 $this->op = 'newfolder';
             } else {
                 $folderName = array();
                 foreach ($array_lang as $langItem) {
                     $folderName[$langItem] = $arrayState[$this->id]['new_folder'][$langItem];
                 }
                 $this->tdb->addFolderByIdTranslation($this->selectedFolder, $folderName);
                 $this->refresh = TRUE;
             }
         } elseif ($key == 'save_renamefolder') {
             $array_lang = Docebo::langManager()->getAllLangCode();
             if ($this->getSelectedFolderId() == '0') {
                 $mand_lang = 'root';
             } else {
                 $mand_lang = getLanguage();
             }
             if (!isset($action[$mand_lang]) || $action[$mand_lang] == '') {
                 $this->op = 'renamefolder';
             } else {
                 $folder_id = $this->getSelectedFolderId();
                 $acl =& Docebo::user()->getACL();
                 //-extra field check mandatory -----------------------------
                 require_once $GLOBALS['where_framework'] . '/lib/lib.field.php';
                 $fields = new FieldList();
                 $fields->setGroupFieldsTable($GLOBALS['prefix_fw'] . ORGCHAR_FIELDTABLE);
                 $fields->setFieldEntryTable($GLOBALS['prefix_fw'] . ORGCHAR_FIELDENTRYTABLE);
                 $folder_id = $this->getSelectedFolderId();
                 $folder =& $this->tdb->getFolderById($folder_id);
                 $ancestor = $this->tdb->getAllParentId($folder, $this->tdb);
                 array_push($ancestor, $folder_id);
                 //$filled = $fields->isFilledFieldsForUser($folder_id, $ancestor, FALSE );
                 //----------------------------------------------------------
                 //if( $filled === true ) {
                 $folderName = array();
                 if ($this->getSelectedFolderId() == '0') {
                     // is root
                     $folderName = $arrayState[$this->id]['rename_folder']['root'];
                     $query_root_name = "\r\n\t\t\t\t\t\t\tUPDATE " . $GLOBALS['prefix_fw'] . "_setting \r\n\t\t\t\t\t\t\tSET param_value = '" . $folderName . "'\r\n\t\t\t\t\t\t\tWHERE param_name = 'title_organigram_chart'";
                     sql_query($query_root_name);
                 } else {
                     foreach ($array_lang as $langItem) {
                         $folderName[$langItem] = $arrayState[$this->id]['rename_folder'][$langItem];
                     }
                     $this->tdb->updateFolderByIdTranslation($this->selectedFolder, $folderName);
                 }
                 //-extra field store --------------------------------------
                 $folder_idst = $this->tdb->getGroupST($folder_id);
                 $fl = new FieldList();
                 $fl->setGroupFieldsTable($GLOBALS['prefix_fw'] . ORGCHAR_FIELDTABLE);
                 $fl->setFieldEntryTable($GLOBALS['prefix_fw'] . ORGCHAR_FIELDENTRYTABLE);
                 $arr_groups_filterd = $acl->getSTGroupsST($folder_idst, FILTER_FOLD);
                 $fl->storeFieldsForUser($folder_id, $ancestor, FALSE);
                 //----------------------------------------------------------
                 $this->refresh = TRUE;
                 if ($this->getSelectedFolderId() == '0') {
                     Util::jump_to('index.php?modname=directory&op=org_chart');
                 }
                 /*} else {
                 			
                 			$this->op = 'renamefolder';
                 			$GLOBALS['page']->add( getErrorUi(implode('<br/>', $filled)), 'content' );
                 		}*/
             }
         } elseif ($key == 'next_formfield1') {
             $this->op = 'folder_field2';
         } elseif ($key == 'save_formfield') {
             require_once $GLOBALS['where_framework'] . '/lib/lib.field.php';
             if (isset($arrayState[$this->id]['field_set'])) {
                 $arr_fields = $arrayState[$this->id]['field_set'];
             } else {
                 $arr_fields = array();
             }
             if (isset($arrayState[$this->id]['field_mandatory'])) {
                 $arr_fields_mandatory = $arrayState[$this->id]['field_mandatory'];
             } else {
                 $arr_fields_mandatory = array();
             }
             $fl = new FieldList();
             $fl->setGroupFieldsTable($GLOBALS['prefix_fw'] . ORGCHAR_FIELDTABLE);
             $arr_all_fields = $fl->getAllFields();
             $id_folder = $this->getSelectedFolderId();
             // remove all fields
             foreach ($arr_all_fields as $id_field => $field) {
                 $fl->removeFieldFromGroup($id_field, $id_folder);
             }
             // add selected fields
             foreach ($arr_fields as $id_field => $dummy_val) {
                 $fl->addFieldToGroup($id_field, $id_folder, isset($arr_fields_mandatory[$id_field]) ? $arr_fields_mandatory[$id_field] : 'false');
             }
         } elseif ($key == 'next1_assignfield') {
             $this->op = 'assign2_field';
         } elseif ($key == 'next2_assignfield') {
             $this->op = 'assign3_field';
         } elseif ($key == 'save_assignfield') {
             $arr_fields = $arrayState[$this->id]['field_set'];
             $arr_fields_mandatory = isset($arrayState[$this->id]['field_mandatory']) ? $arrayState[$this->id]['field_mandatory'] : array();
             $arr_fields_useraccess = isset($arrayState[$this->id]['field_useraccess']) ? $arrayState[$this->id]['field_useraccess'] : array();
             require_once $GLOBALS['where_framework'] . '/lib/lib.field.php';
             $fl = new FieldList();
             foreach ($arr_fields as $id_filed => $status) {
                 switch ($status) {
                     case ORG_CHART_FIELD_NO:
                         $fl->removeFieldFromGroup($id_filed, $this->tdb->getGroupST($this->getSelectedFolderId()));
                         $fl->removeFieldFromGroup($id_filed, $this->tdb->getGroupDescendantsST($this->getSelectedFolderId()));
                         break;
                     case ORG_CHART_FIELD_NORMAL:
                         $fl->removeFieldFromGroup($id_filed, $this->tdb->getGroupDescendantsST($this->getSelectedFolderId()));
                         $fl->addFieldToGroup($id_filed, $this->tdb->getGroupST($this->getSelectedFolderId()), isset($arr_fields_mandatory[$id_filed]) ? $arr_fields_mandatory[$id_filed] : 'false', isset($arr_fields_useraccess[$id_filed]) ? $arr_fields_useraccess[$id_filed] : 'readonly');
                         break;
                     case ORG_CHART_FIELD_DESCEND:
                         $fl->removeFieldFromGroup($id_filed, $this->tdb->getGroupST($this->getSelectedFolderId()));
                         $fl->addFieldToGroup($id_filed, $this->tdb->getGroupDescendantsST($this->getSelectedFolderId()), isset($arr_fields_mandatory[$id_filed]) ? $arr_fields_mandatory[$id_filed] : 'false', isset($arr_fields_useraccess[$id_filed]) ? $arr_fields_useraccess[$id_filed] : 'readonly');
                         break;
                 }
             }
         } elseif ($key == $this->_getOpFolderField()) {
             if (is_array($action)) {
                 $this->selectedFolder = key($action);
             }
             $this->op = 'folder_field';
         } elseif ($key == $this->_getOpImportUsers()) {
             if (is_array($action)) {
                 $this->selectedFolder = key($action);
             }
             $this->op = 'import_users';
         } elseif ($key == 'next1_importusers') {
             $this->op = 'import_users2';
         } elseif ($key == 'next2_importusers') {
             $this->op = 'import_users3';
         } elseif ($key == $this->_getOpAssignField()) {
             if (is_array($action)) {
                 $this->selectedFolder = key($action);
             }
             $this->op = 'assign_field';
         } elseif ($key == $this->_getOpAssignUser()) {
             if (is_array($action)) {
                 $this->selectedFolder = key($action);
             }
             $this->op = 'addtotree';
         } elseif ($key == $this->_getOpCreateUser()) {
             if (is_array($action)) {
                 $this->selectedFolder = key($action);
             }
             $this->op = 'create_user';
         } elseif ($key == $this->_getOpWaitingUser()) {
             $this->op = 'waiting_user';
         }
     }
     return;
     $arrayExpand = $arrayExpand;
     $arrayCompress = $arrayCompress;
 }