示例#1
0
 /**
  * Load css and yui file
  * @return null
  * @param $js Array[optional]
  * @param $css Array[optional]
  */
 public static function load($module_list = false, $noprint = false)
 {
     $module_list = 'base,autocomplete,charts,tabview,table,treeview,colorpicker';
     if (strpos($module_list, 'base') !== false) {
         $module_list = 'base,' . $module_list;
     }
     $list = explode(',', $module_list);
     $js_load = array();
     $css_load = array();
     foreach ($list as $k => $module) {
         if (isset(self::$_css_map[$module])) {
             $css_load = array_unique(array_merge($css_load, self::$_css_map[$module]));
         }
         if (isset(self::$_js_map[$module])) {
             $js_load = array_unique(array_merge($js_load, self::$_js_map[$module]));
         }
     }
     // remove js alredy loaded
     $css_load = array_diff($css_load, self::$_css_loaded);
     $js_load = array_diff($js_load, self::$_js_loaded);
     if (empty($css_load) && empty($js_load)) {
         return '';
     }
     // load new css
     $to_load = '';
     if (!empty($css_load)) {
         $to_load .= '<!-- yui css -->';
         foreach ($css_load as $k => $filename) {
             $to_load .= Util::get_css(Get::tmpl_path('base') . 'yui-skin/' . $filename, true);
         }
     }
     // load new js
     if (!empty($js_load)) {
         $to_load .= '<!-- yui js -->';
         foreach ($js_load as $k => $filename) {
             $to_load .= Util::get_js('/addons/yui/' . $filename);
             if ($filename == 'utilities/utilities.js') {
                 $to_load .= "\n" . '<script type="text/javascript"> YAHOO.util.Connect.initHeader(\'X-Signature\',\'' . Util::getSignature() . '\'); YAHOO.util.Connect.startEvent.subscribe(function() { YAHOO.util.Connect.initHeader(\'X-Signature\',\'' . Util::getSignature() . '\'); });</script>';
             }
             if ($filename == 'charts/charts-min.js') {
                 $to_load .= "\n" . '<script type="text/javascript"> YAHOO.widget.Chart.SWFURL = "' . Get::rel_path('base') . '/addons/yui/charts/assets/charts.swf"; </script>';
             }
         }
         if (Lang::direction() == 'rtl') {
             $to_load .= Util::get_js('/addons/yui/yui-rtl.js');
         }
     }
     // add loaded file to the cache
     if (!empty($css_load)) {
         self::$_css_loaded = array_merge(self::$_css_loaded, $css_load);
     }
     if (!empty($js_load)) {
         self::$_js_loaded = array_merge(self::$_js_loaded, $js_load);
     }
     if (function_exists('cout') && !$noprint) {
         cout($to_load, 'page_head');
     } else {
         return $to_load;
     }
 }
示例#2
0
 /**
  * public static function openForm( $id , $action, $css_class, $method, $enctype, $other )
  *
  * @param string $id 		the form id
  * @param string $action 	the action of the form
  * @param string $css_form 	optional css class for this form, if false default, if blacnk not added class=""
  * @param string $method 	optional method for this form
  * @param string $enctype 	optional enctype for this form
  * @param string $other 	optional code for the form tag
  * @return string 	with the form opening html code
  */
 public static function openForm($id, $action, $css_form = false, $method = false, $enctype = '', $other = '')
 {
     $editor_extra = getEditorExtra();
     $other .= !empty($editor_extra) ? " " . $editor_extra : "";
     if ($css_form === false) {
         $css_form = 'std_form';
     }
     if ($method == false) {
         $method = 'post';
     }
     return '<form ' . ($css_form == '' ? '' : ' class="' . $css_form . '"') . ' id="' . $id . '" method="' . $method . '" action="' . $action . '"' . ($enctype != '' ? ' enctype="' . $enctype . '"' : '') . $other . '>' . "\n" . '<div>' . "\n" . '<input type="hidden" id="authentic_request_' . $id . '" name="authentic_request" value="' . Util::getSignature() . '" />';
 }
 function LOSelector($module, $back_url)
 {
     $query = "SELECT objectType FROM " . $GLOBALS['prefix_lms'] . "_lo_types";
     $rs = sql_query($query) or die('Table _lo_types not present');
     $out = '<div class="std_block">';
     $out .= '<div class="title">' . Lang::t('_SELECTLO', 'storage', 'lms') . '</div><br />';
     $out .= getBackUi(Util::str_replace_once('&', '&amp;', $back_url), Lang::t('_BACK'));
     $out .= '<form id="LOSelector" method="post" action="index.php?modname=' . $module . '&amp;op=display&amp;' . $this->_getOpCreateLOSel() . '=1" >' . '<input type="hidden" id="authentic_request_lo" name="authentic_request" value="' . Util::getSignature() . '" />';
     $first = TRUE;
     while (list($objectType) = sql_fetch_row($rs)) {
         $out .= '<label for="' . $objectType . '"><img src="' . getPathImage() . 'lobject/' . $objectType . '.gif" alt="' . $objectType . '" ' . 'title="' . $objectType . '" /></label>';
         if ($first) {
             $out .= '<input type="radio" name="radiolo" value="' . $objectType . '" id="' . $objectType . '" checked="true"/>';
         } else {
             $out .= '<input type="radio" name="radiolo" value="' . $objectType . '" id="' . $objectType . '"/>';
         }
         $out .= '<label for="' . $objectType . '">' . Lang::t('_LONAME_' . $objectType) . '</label>' . '<br />';
         $first = FALSE;
     }
     $out .= $this->printState();
     $out .= '<br /><input type="submit" class="button" value="' . Lang::t('_REPOCREATELO') . '" name="' . $this->_getOpCreateLOSel() . '"/>';
     $out .= '</form>';
     $out .= '</div>';
     return $out;
 }
示例#4
0
 function getExtraTop()
 {
     global $modname;
     if ($this->isFindingDestination()) {
         require_once $GLOBALS['where_framework'] . '/lib/lib.sessionsave.php';
         $saveObj = new Session_Save();
         $saveName = $_GET['crepo'];
         if ($saveObj->nameExists($saveName)) {
             $saveData =& $saveObj->load($saveName);
             return '<div class="std_block">' . '<form id="homereposhow" method="post"' . ' action="index.php?modname=' . $modname . '&amp;op=display&amp;crepo=' . $_GET['crepo'] . '&amp;' . $this->treeView->_getOpCopyLOSel() . '=1"' . ' >' . "\n" . '<input type="hidden" id="authentic_request_hrm" name="authentic_request" value="' . Util::getSignature() . '" />' . $this->lang->def('_REPOSELECTDESTINATION') . ' <img src="' . getPathImage() . 'lobject/' . $saveData['objectType'] . '.gif" alt="' . $saveData['objectType'] . '" title="' . $saveData['objectType'] . '"/>' . $saveData['name'];
         }
     }
     return "";
 }
示例#5
0
function organization_showerror(&$treeView)
{
    $lang =& DoceboLanguage::createInstance('organization', 'lms');
    global $modname, $op;
    $GLOBALS['page']->add('<form id="orgshow" method="post"' . ' action="index.php?modname=' . $modname . '&amp;op=organization"' . ' >' . "\n" . '<input type="hidden" id="authentic_request_org" name="authentic_request" value="' . Util::getSignature() . '" />');
    $GLOBALS['page']->add('<div class="std_block">');
    if ($treeView->error == TVERR_MOVEONDESCENDANT) {
        $GLOBALS['page']->add($lang->def('_ERROR_MOVEONDESCENDANT'));
    }
    $GLOBALS['page']->add(' <img src="' . $treeView->_getCancelImage() . '" alt="' . $treeView->_getCancelAlt() . '" />' . '<input type="submit" class="LVAction" value="' . $treeView->_getCancelLabel() . '"' . ' name="' . $treeView->_getCancelId() . '" id="' . $treeView->_getCancelId() . '" />');
    $GLOBALS['page']->add('</div>');
    $GLOBALS['page']->add('</form>');
}
示例#6
0
 /** This function return a string with start output for print
  *	tabview and related content
  *	@return string the output of the TabView
  **/
 function printTabView_Begin($url_param = "", $print_form = TRUE)
 {
     $tvout = '<div class="TabView_container">';
     //open form
     if ($print_form) {
         $tvout .= '<form action="' . $this->post_url . ($url_param != "" ? '&amp;' . $url_param : '') . '" method="' . $this->method . '">' . '<input type="hidden" id="authentic_request_tv" name="authentic_request" value="' . Util::getSignature() . '" />';
     }
     // print tab
     $tvout .= '<ul class="TabView_tabspace">';
     while (($tab = current($this->arrTab)) !== FALSE) {
         $tvout .= $tab->printLabel();
         next($this->arrTab);
     }
     reset($this->arrTab);
     $tvout .= '</ul>';
     // close form
     if ($print_form) {
         $tvout .= '</form>';
     }
     $tvout .= '<div class="TabView_content"><br />' . "\n";
     return $tvout;
 }
示例#7
0
 function homerepo_itemproperties(&$treeView, &$arrayData, $idItem)
 {
     //function loadFields( $arrayData, &$lo, $idLO ) {
     $lang =& DoceboLanguage::createInstance('homerepo', 'lms');
     $langClassification =& DoceboLanguage::createInstance('classification', 'lms');
     $GLOBALS['page']->add('<form id="manHomerepo" method="post"' . ' action="index.php?' . $_SERVER['QUERY_STRING'] . '"' . ' >' . "\n" . '<input type="hidden" id="authentic_request_hrs" name="authentic_request" value="' . Util::getSignature() . '" />');
     $GLOBALS['page']->add('<div class="std_block">');
     $GLOBALS['page']->add($treeView->printState());
     global $defaultLanguage;
     //including language
     //includeLang("classification");
     //finding category
     $reCategory = sql_query("\r\n\tSELECT idCategory, title \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_coursecategory\r\n\tORDER BY title");
     //searching languages
     /*$langl = dir('menu/language/');
     	while($ele = $langl->read())
     		if(ereg("lang-",$ele)) {
     			$langArray[] = ereg_replace("lang-","",ereg_replace(".php","",$ele));
     		}
     	closedir($langl->handle);
     	sort($langArray);*/
     $langArray = Docebo::langManager()->getAllLangCode();
     if (!isset($_POST['idItem'])) {
         if ($idItem !== NULL) {
             $folder = $treeView->tdb->getFolderById($idItem);
             $GLOBALS['page']->add('<input type="hidden" name="idItem" id="idItem" value="' . $idItem . '" />');
             $title = $folder->otherValues[REPOFIELDTITLE];
             $arrayData['version'] = $folder->otherValues[REPOFIELDVERSION];
             $arrayData['difficult'] = $folder->otherValues[REPOFIELDDIFFICULT];
             $arrayData['language'] = $folder->otherValues[REPOFIELDLANGUAGE];
             $arrayData['resource'] = $folder->otherValues[REPOFIELDRESOURCE];
             $arrayData['objective'] = $folder->otherValues[REPOFIELDOBJECTIVE];
         }
     } else {
         $GLOBALS['page']->add('<input type="hidden" name="idItem" id="idItem" value="' . $idItem . '" />');
         $title = $_POST['title'];
     }
     // ==========================================================
     $GLOBALS['page']->add('<input type="hidden" name="title" id="title" value="' . $title . '" />');
     $GLOBALS['page']->add('<div class="ObjectForm">');
     $GLOBALS['page']->add('<span class="mainTitle">' . $langClassification->def('_CATEGORIZATION') . ' ' . $title . '</span><br /><br />');
     $GLOBALS['page']->add('</div>');
     //-------------------------------------------------
     /*		.'<div class="title">'._CATEGORY.'</div>'
     		.'<div class="content">'
     		.'<select name="idCategory">';
     		
     	if( isset($arrayData['idCategory']) )
     		$selectedIdCat = $arrayData['idCategory'];
     	else
     		$selectedIdCat = "";
     	
     	while(list($idCat, $catTitle) = sql_fetch_row($reCategory)) {
     		if( $selectedIdCat == $idCat )
     			echo '<option value="'.$idCat.'" selected >'.$catTitle.'</option>';
     		else
     			echo '<option value="'.$idCat.'">'.$catTitle.'</option>';
     	}
     	echo '</select> ( '.sql_num_rows($reCategory).' '._DISP.')'
     		.'</div>'*/
     //-------------------------------------------------
     $GLOBALS['page']->add('<div class="title">' . $langClassification->def('_VERSION') . '</div>' . '<div class="content">');
     if (isset($arrayData['version'])) {
         $GLOBALS['page']->add('<input type="text" name="version" maxlength="8" size="10" value="' . $arrayData['version'] . '" />');
     } else {
         $GLOBALS['page']->add('<input type="text" name="version" maxlength="8" size="10" value="1.0" />');
     }
     $GLOBALS['page']->add('</div>' . '<div class="title">' . $langClassification->def('_DIFFICULTY') . '</div>' . '<div class="content">' . '<select name="difficult">');
     if (isset($arrayData['difficult'])) {
         $selDiff = $arrayData['difficult'];
         switch ($selDiff) {
             case '_DIFFICULT_VERYEASY':
                 $selDiff = "1";
                 break;
             case '_DIFFICULT_EASY':
                 $selDiff = "2";
                 break;
             case '_DIFFICULT_MEDIUM':
                 $selDiff = "3";
                 break;
             case '_DIFFICULT_DIFFICULT':
                 $selDiff = "4";
                 break;
             case '_DIFFICULT_VERYDIFFICULT':
                 $selDiff = "5";
                 break;
         }
     } else {
         $selDiff = "";
     }
     $GLOBALS['page']->add('<option value="1" ' . ($selDiff == "1" ? 'selected' : '') . ' >' . $langClassification->def('_DIFFICULT_VERYEASY') . '</option>' . '<option value="2" ' . ($selDiff == "2" ? 'selected' : '') . ' >' . $langClassification->def('_DIFFICULT_EASY') . '</option>' . '<option value="3" ' . ($selDiff == "3" ? 'selected' : '') . ' >' . $langClassification->def('_DIFFICULT_MEDIUM') . '</option>' . '<option value="4" ' . ($selDiff == "4" ? 'selected' : '') . ' >' . $langClassification->def('_DIFFICULT_DIFFICULT') . '</option>' . '<option value="5" ' . ($selDiff == "5" ? 'selected' : '') . ' >' . $langClassification->def('_DIFFICULT_VERYDIFFICULT') . '</option>' . '</select>' . '</div>');
     //-------------------------------------------------
     /*.'<div class="title">'._DESCRIPTION.'</div>'
     		.'<div class="content">'
     		.'<div id="breakfloat">'
     			.'<textarea id="description" name="description" rows="10" cols="75"></textarea></div>'
     		.'</div>'*/
     //-------------------------------------------------
     $GLOBALS['page']->add('<div class="title">' . $langClassification->def('_LANGUAGE') . '</div>' . '<div class="content">' . '<select name="language">');
     if (isset($arrayData['language'])) {
         $selLang = $arrayData['language'];
     } else {
         $selLang = $defaultLanguage;
     }
     while (list(, $valueLang) = each($langArray)) {
         $GLOBALS['page']->add('<option value="' . $valueLang . '"');
         if ($valueLang == $selLang) {
             $GLOBALS['page']->add(' selected="selected"');
         }
         $GLOBALS['page']->add('>' . $valueLang . '</option>');
     }
     $GLOBALS['page']->add('</select>' . '</div>' . '<div class="title">' . $langClassification->def('_RESOURCE') . '</div>' . '<div class="content">');
     if (isset($arrayData['resource'])) {
         $GLOBALS['page']->add('<input type="text" name="resource" maxlength="255" size="60" value="' . $arrayData['resource'] . '" />');
     } else {
         $GLOBALS['page']->add('<input type="text" name="resource" maxlength="255" size="60" value="http://" />');
     }
     $GLOBALS['page']->add('</div>' . '<div class="title">' . $langClassification->def('_OBJECTIVE') . '</div>' . '<div class="content">');
     if (isset($arrayData['objective'])) {
         $GLOBALS['page']->add('<textarea name="objective" rows="6" cols="75">' . $arrayData['objective'] . '</textarea>');
     } else {
         $GLOBALS['page']->add('<textarea name="objective" rows="6" cols="75"></textarea>');
     }
     $GLOBALS['page']->add('<br />');
     $GLOBALS['page']->add('<img src="' . $treeView->_getSaveImage() . '" alt="' . $lang->def('_SAVE') . '" /> ' . '<input type="submit" value="' . $lang->def('_SAVE') . '" class="LVAction"' . ' name="' . $treeView->_getOpSaveFile() . '" />');
     $GLOBALS['page']->add(' <img src="' . $treeView->_getCancelImage() . '" alt="' . $treeView->_getCancelAlt() . '" />' . '<input type="submit" class="LVAction" value="' . $treeView->_getCancelLabel() . '"' . ' name="' . $treeView->_getCancelId() . '" id="' . $treeView->_getCancelId() . '" />');
     $GLOBALS['page']->add('</div>');
     $GLOBALS['page']->add('</div>');
     $GLOBALS['page']->add('</form>');
 }
示例#8
0
function initDialogs()
{
    require_once _base_ . '/lib/lib.json.php';
    Util::get_js(Get::rel_path('base') . '/widget/dialog/dialog.js', true, true);
    $json = new Services_JSON();
    $script = 'YAHOO.dialogConstants.setProperties({' . 'CONFIRM: ' . $json->encode(Lang::t('_CONFIRM', 'standard')) . ', ' . 'UNDO: ' . $json->encode(Lang::t('_UNDO', 'standard')) . ', ' . 'CLOSE: ' . $json->encode(Lang::t('_CLOSE', 'standard')) . ', ' . 'LOADING: ' . $json->encode(Lang::t('_LOADING', 'standard')) . ', ' . 'ERROR: ' . $json->encode(Lang::t('_OPERATION_FAILURE', 'standard')) . ', ' . 'SERVER_ERROR: ' . $json->encode(Lang::t('_CONNECTION_ERROR', 'standard')) . ', ' . 'loadingIcon: ' . $json->encode(Get::tmpl_path() . 'images/standard/loadbar.gif') . ', ' . 'smallLoadingIcon: ' . $json->encode(Get::tmpl_path() . 'images/standard/loading_circle.gif') . ', ' . 'authentication: "' . Util::getSignature() . '" ' . '});' . "\n";
    cout('<script type="text/javascript">' . $script . '</script>', 'scripts');
}
示例#9
0
/**
 * This function can be called from LO insert/edit operation
 * to set position in pubrepo and other metadata.
 * @param $lo instance of the learning object to edit
 * @param $withForm print form tag
 * @param $withContents display the Items in folders
 **/
function manPubRepoSave(&$lo, $withForm = FALSE, $withContents = TRUE)
{
    $treeView = manPubrepo_CreateTreeView($withContents, FALSE);
    // print a form that submit to the same url
    if ($withForm) {
        echo '<form name="manPubrepo" method="post"' . ' action="index.php?' . $_SERVER['QUERY_STRING'] . '"' . ' >' . "\n" . '<input type="hidden" id="authentic_request_pr" name="authentic_request" value="' . Util::getSignature() . '" />';
    }
    // handle operations
    switch ($treeView->op) {
        case 'newfolder':
            manPubrepo_addfolder($treeView);
            break;
        case 'save':
            manPurepo_save($treeView->getSelectedFolderId(), $lo, $_POST);
            Util::jump_to('' . $lo->getBackUrl());
        case 'display':
        default:
            manPubrepo_display($treeView, $withContents);
            loadFields($_POST, $lo);
            break;
    }
    // add save button
    echo '<img src="' . getPathImage() . 'standard/save.gif" alt="' . _SAVE . '" /> ' . '<input type="submit" value="' . _SAVE . '"' . ' name="' . $treeView->_getOpSaveFile() . '" />';
    if ($withForm) {
        echo '</form>' . "\n";
    }
}
示例#10
0
 function loadOrgChartView()
 {
     require_once dirname(__FILE__) . '/../modules/org_chart/tree.org_chart.php';
     $lang =& DoceboLanguage::createInstance('organization_chart', 'framework');
     $userlevelid = Docebo::user()->getUserLevelId();
     $repoDb = new TreeDb_OrgDb($GLOBALS['prefix_fw'] . '_org_chart_tree');
     $treeView = new TreeView_OrgView($repoDb, 'organization_chart', Get::sett('title_organigram_chart'));
     $treeView->setLanguage($lang);
     $treeView->aclManager =& $this->aclManager;
     if ($userlevelid != ADMIN_GROUP_GODADMIN) {
         require_once $GLOBALS['where_framework'] . '/lib/lib.adminmanager.php';
         $adminManager = new AdminManager();
         $treeView->setFilterNodes($adminManager->getAdminTree(Docebo::user()->getIdSt()));
     }
     $treeView->loadState();
     $treeView->parsePositionData($_POST, $_POST, $_POST);
     $treeView->selector_mode = $this->selector_mode;
     $treeView->simple_selector = $this->show_orgchart_simple_selector;
     $treeView->itemSelectedMulti = $this->selection;
     $treeView->itemSelectedMulti_alt = $this->selection_alt;
     $treeView->multi_choice = $this->multi_choice;
     $treeView->select_all = $this->select_all;
     $treeView->deselect_all = $this->deselect_all;
     $treeView->saveState();
     require_once _base_ . '/lib/lib.form.php';
     $GLOBALS['page']->add('<link href="' . getPathTemplate('framework') . '/style/base-old-treeview.css" rel="stylesheet" type="text/css" />', 'page_head');
     $GLOBALS['page']->setWorkingZone('content');
     if (!$this->selector_mode) {
         $GLOBALS['page']->add(getTitleArea($lang->def('_ORG_CHART'), 'org_chart'));
         $GLOBALS['page']->add('<div class="std_block">');
         $GLOBALS['page']->addEnd('</div>');
     }
     if ($treeView->op != '') {
         $processed = FALSE;
         switch ($treeView->op) {
             case 'reedit_person':
                 $processed = TRUE;
                 $this->editPerson();
                 break;
             case 'create_user':
                 //$this->org_createUser($treeView->getSelectedFolderId());
                 $processed = TRUE;
                 Util::jump_to('index.php?modname=directory&op=org_createuser&treeid=' . $treeView->getSelectedFolderId());
                 break;
             case 'addtotree':
                 $processed = TRUE;
                 Util::jump_to('index.php?modname=directory&op=addtotree&treeid=' . $treeView->getSelectedFolderId());
                 break;
             case 'waiting_user':
                 $processed = TRUE;
                 Util::jump_to('index.php?modname=directory&op=org_waitinguser&treeid=' . $treeView->getSelectedFolderId());
                 break;
         }
         if (!$this->selector_mode && !$processed) {
             $GLOBALS['page']->add(Form::openForm('directory_org_chart', 'index.php?modname=directory&amp;op=org_chart', 'std_form', 'post', 'multipart/form-data'));
             $GLOBALS['page']->addEnd(Form::closeForm());
         }
         switch ($treeView->op) {
             case 'newfolder':
                 $GLOBALS['page']->add($treeView->loadNewFolder());
                 break;
             case 'deletefolder':
                 $GLOBALS['page']->add($treeView->loadDeleteFolder());
                 break;
             case 'renamefolder':
                 $GLOBALS['page']->add($treeView->loadRenameFolder());
                 break;
             case 'movefolder':
                 $GLOBALS['page']->add($treeView->loadMoveFolder());
                 break;
             case 'import_users':
                 $GLOBALS['page']->add($treeView->loadImportUsers());
                 break;
             case 'import_users2':
                 $GLOBALS['page']->add($treeView->loadImportUsers2());
                 break;
             case 'import_users3':
                 $GLOBALS['page']->add($treeView->loadImportUsers3());
                 break;
             case 'assign2_field':
                 $GLOBALS['page']->add($treeView->loadAssignField2());
                 break;
             case 'assign_field':
                 $GLOBALS['page']->add($treeView->loadAssignField());
                 break;
             case 'folder_field2':
                 $GLOBALS['page']->add($treeView->loadFolderField2());
                 break;
             case 'folder_field':
                 $GLOBALS['page']->add($treeView->loadFolderField());
                 break;
         }
     } else {
         if (!$this->selector_mode) {
             //quick change password
             if (checkPerm('edituser_org_chart', true, 'directory', 'framework')) {
                 $GLOBALS['page']->add('<div class="align_right">' . '<a href="javascript:;" onclick="YAHOO.Animation.BlindToggle(\'quick_change\');">' . $lang->def('_CHANGEPASSWORD') . '</a>' . '<div id="quick_change" style="display:none;">' . '<form method="post" action="index.php?modname=directory&amp;op=quick_change_password">' . '<div class="instruction_container">' . '<input type="hidden" id="authentic_request_chpwd" name="authentic_request" value="' . Util::getSignature() . '" />' . '<label for="cp_userid">' . $lang->def('_USERNAME') . ' </label>' . '<input type="text" id="cp_userid" name="cp_userid" maxlenght="255" />&nbsp;&nbsp;' . '<label for="cp_pwd">' . $lang->def('_PASSWORD') . ' </label>' . '<input type="password" id="cp_pwd" name="cp_pwd" maxlenght="255" autocomplete="off" />&nbsp;&nbsp;' . '<input type="submit" id="cp_click" name="cp_click" value="' . $lang->def("_SAVE") . '" /><br/>' . '<input type="checkbox" id="cp_force" name="cp_force" value="1" checked="checked" />' . ' <label for="cp_force">' . $lang->def('_FORCE_CHANGE') . '</label>' . '</div>' . '</form>' . '</div>' . '</div><br/>');
             }
             $treeView->lv_data = new PeopleDataRetriever($GLOBALS['dbConn'], $GLOBALS['prefix_fw']);
             $rend = new Table(Get::sett('visuUser'));
             $treeView->lv_view = new PeopleListView('', $treeView->lv_data, $rend, 'usersmembersdirectory');
             $treeView->lv_view->hide_suspend = FALSE;
             $treeView->lv_view->setLinkPagination("index.php?modname=directory&amp;op=org_chart");
             $treeView->lv_view->aclManager =& $this->aclManager;
             $treeView->lv_view->parsePositionData($_POST);
             if ($treeView->lv_view->getOp() == 'newitem') {
                 $this->editPerson();
             } elseif ($treeView->lv_view->getOp() == 'editperson') {
                 $this->editPerson($treeView->lv_view->getIdSelectedItem());
             } elseif ($treeView->lv_view->getOp() == 'deleteperson') {
                 $this->deletePerson($treeView->lv_view->getIdSelectedItem());
             } else {
                 if ($treeView->lv_view->getOp() == 'removeperson') {
                     $idmember = $treeView->lv_view->getIdSelectedItem();
                     $idmember_idst = $this->aclManager->getUserST($idmember);
                     $id_org = $treeView->getSelectedFolderId();
                     $id_org_idst = $treeView->tdb->getGroupST($id_org);
                     $id_org_desc_idst = $treeView->tdb->getGroupDescendantsST($id_org);
                     // echo "\nmember idst: $member_idst, org_idst: $id_org_idst, org_desc_idst: $id_org_desc_idst\n";
                     $this->aclManager->removeFromGroup($id_org_idst, $idmember_idst);
                     $this->aclManager->removeFromGroup($id_org_desc_idst, $idmember_idst);
                     $treeView->lv_view->op = '';
                 }
                 $GLOBALS['page']->add(Form::openForm('directory_org_chart', 'index.php?modname=directory&amp;op=org_chart'));
                 $GLOBALS['page']->addEnd(Form::closeForm());
                 if (Get::sett('use_org_chart') == '1') {
                     $GLOBALS['page']->add($treeView->load());
                     $GLOBALS['page']->add($treeView->loadActions());
                 }
                 if (Get::sett('use_org_chart') == '1') {
                     $id_org = $treeView->getSelectedFolderId();
                     if ($id_org > 0 && $treeView->isFolderAccessible()) {
                         if ($treeView->lv_view->flat_mode) {
                             $groupid = $treeView->tdb->getGroupDescendantsId($id_org);
                         } else {
                             $groupid = $treeView->tdb->getGroupId($id_org);
                         }
                     }
                 } else {
                     $id_org = 0;
                 }
                 if ($id_org > 0 && $treeView->isFolderAccessible()) {
                     $this->membersTree($groupid, $treeView);
                 } elseif ($id_org == 0) {
                     $this->membersTree('', $treeView);
                 }
                 if (Get::sett('use_org_chart') != '1') {
                     $GLOBALS['page']->add($treeView->loadActions());
                 }
             }
         } else {
             $GLOBALS['page']->add($treeView->load());
         }
     }
 }
示例#11
0
function statoneuser()
{
    $lang =& DoceboLanguage::createInstance('stats', 'lms');
    $out =& $GLOBALS['page'];
    $aclManager =& Docebo::user()->getACLManager();
    $out->setWorkingZone('content');
    $out->add(getTitleArea($lang->def('_STATFORUSER'), 'stats', false, true));
    $out->add('<div class="std_block">');
    $idst = (int) $_GET['idUser'];
    $user_info = $aclManager->getUser($idst, FALSE);
    $orgDb = new StatOrg_TreeDb();
    $treeView = new StatOrg_TreeView($orgDb, $_SESSION['idCourse']);
    $treeView->stat_idUser = $idst;
    $treeView->parsePositionData($_POST, $_POST, $_POST);
    // print container div and form
    $out->add(getBackUi('index.php?modname=stats&amp;op=statuser', $lang->def('_BACK')));
    $out->add('<div class="title">' . $lang->def('_STATFORUSER') . ' ' . $user_info[ACL_INFO_FIRSTNAME] . ' ' . $user_info[ACL_INFO_LASTNAME] . '</div>');
    $out->add('<form name="orgshow" method="post"' . ' action="index.php?modname=stats&amp;op=statoneuser&amp;idUser='******'"' . ' >' . "\n" . '<input type="hidden" id="authentic_request_org" name="authentic_request" value="' . Util::getSignature() . '" />');
    $out->add($treeView->load());
    //if( funAccess('orgedit','MOD', TRUE, 'organization' ) ) $treeView->loadActions();
    $out->add('</form>');
    // print form for import action
    // display track if exists
    $item = $orgDb->getFolderById($treeView->getSelectedFolderId());
    $values = $item->otherValues;
    $param = $treeView->printState(FALSE);
    $arrBack_Url = array('address' => 'index.php?modname=stats&op=statoneuser&idUser='******'end_address' => 'index.php?modname=stats&op=statoneuser&idUser='******'param' => $param);
    require_once _lms_ . '/class.module/track.object.php';
    //find idTrack
    $idTrack = Track_Object::getIdTrackFromCommon($treeView->getSelectedFolderId(), $treeView->stat_idUser);
    if ($idTrack) {
        $lo = createLOTrack($idTrack, $values[REPOFIELDOBJECTTYPE], $values[REPOFIELDIDRESOURCE], $values[ORGFIELDIDPARAM], $arrBack_Url);
        if ($lo !== false) {
            $GLOBALS['wrong_way_to_pass_parameter'] = $lo->idReference;
            //$values[REPOFIELDIDRESOURCE];
            $out->add($lo->loadReport($treeView->stat_idUser));
        }
    }
    $out->add('</div>');
}
示例#12
0
function modassignpoint()
{
    checkPerm('view', false, 'storage');
    $lang =& DoceboLanguage::createInstance('test');
    require_once _base_ . '/lib/lib.table.php';
    require_once _base_ . '/lib/lib.form.php';
    $idTest = importVar('idTest', true, 0);
    $back_url = urldecode(importVar('back_url'));
    $url_coded = htmlentities(urlencode($back_url));
    //jump back
    if (isset($_POST['back_to_home'])) {
        Util::jump_to('index.php?modname=test&op=modtestgui&idTest=' . $idTest . '&back_url=' . $url_coded);
    }
    //save new score ------------------------------------------------
    if (isset($_POST['saveandexit'])) {
        $query_question = "\r\n\t\tSELECT q.idQuest, q.type_quest, t.type_file, t.type_class \r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_testquest AS q JOIN " . $GLOBALS['prefix_lms'] . "_quest_type AS t \r\n\t\tWHERE q.idTest = '" . (int) $idTest . "' AND q.type_quest = t.type_quest";
        $query_question .= " ORDER BY q.sequence";
        $re_quest = sql_query($query_question);
        $score_assign = array();
        while (list($idQuest, $type_quest, $type_file, $type_class) = sql_fetch_row($re_quest)) {
            sql_query("\r\n\t\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_testquest \r\n\t\t\tSET difficult = '" . (int) $_POST['new_difficult_quest'][$idQuest] . "' \r\n\t\t\tWHERE idTest = '" . $idTest . "' AND idQuest = '" . (int) $idQuest . "'");
            require_once dirname(__FILE__) . '/../question/' . $type_file;
            $quest_obj = eval("return new {$type_class}( {$idQuest} );");
            $score_assign[$idQuest] = $quest_obj->setMaxScore($_POST['new_score_quest'][$idQuest]);
        }
    }
    list($test_title) = sql_fetch_row(sql_query("\r\n\tSELECT title \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_test \r\n\tWHERE idTest = '" . $idTest . "'"));
    list($tot_quest, $tot_difficult) = sql_fetch_row(sql_query("\r\n\tSELECT COUNT(*), SUM(difficult) \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_testquest \r\n\tWHERE idTest = '{$idTest}' AND type_quest <> 'break_page' AND type_quest <> 'title'"));
    $query_question = "\r\n\tSELECT q.idQuest, q.type_quest, t.type_file, t.type_class, q.title_quest, q.difficult \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_testquest AS q JOIN " . $GLOBALS['prefix_lms'] . "_quest_type AS t \r\n\tWHERE q.idTest = '" . (int) $idTest . "' AND q.type_quest = t.type_quest";
    $query_question .= " ORDER BY q.sequence";
    $re_quest = sql_query($query_question);
    $GLOBALS['page']->add(getTitleArea($lang->def('_TEST_SECTION'), 'test') . '<div class="std_block">' . getBackUi('index.php?modname=test&amp;op=defpoint&amp;idTest=' . $idTest . '&amp;back_url=' . $url_coded, $lang->def('_BACK')) . '<form method="post" action="index.php?modname=test&amp;op=modassignpoint">' . '<input type="hidden" id="authentic_request_test" name="authentic_request" value="' . Util::getSignature() . '" />' . '<fieldset class="fieldset_std">' . '<legend>' . $lang->def('_TEST_TM2_CAPTIONSETTIME') . '</legend>' . '<input type="hidden" name="idTest" value="' . $idTest . '" />' . '<input type="hidden" name="back_url" value="' . $url_coded . '" />', 'content');
    //table header---------------------------------------------------
    $tab_quest = new Table(0, $lang->def('_TEST_SUMMARY'), $lang->def('_TEST_SUMMARY'));
    $tab_quest->setColsStyle(array('image', 'image', '', 'image', 'image'));
    $tab_quest->addHead(array($lang->def('_TEST_QUEST_ORDER'), $lang->def('_TYPE'), $lang->def('_QUESTION'), $lang->def('_DIFFICULTY'), $lang->def('_SCORE')));
    $i = 1;
    $effective_tot_score = $effective_difficult = 0;
    //table body--------------------------------------------------------
    while (list($idQuest, $type_quest, $type_file, $type_class, $title_quest, $difficult) = sql_fetch_row($re_quest)) {
        require_once dirname(__FILE__) . '/../question/' . $type_file;
        $quest_obj = eval("return new {$type_class}( {$idQuest} );");
        if (isset($_POST['new_score_quest'][$idQuest])) {
            //loading new time form previous page
            $difficult = $_POST['new_difficult_quest'][$idQuest];
            $quest_score = $quest_obj->getRealMaxScore($_POST['new_score_quest'][$idQuest], true);
        } elseif (isset($_POST['point_assignement'])) {
            //calculate new time from deftime page
            switch ($_POST['point_assignement']) {
                case "0":
                    $quest_score = $quest_obj->getRealMaxScore(round(round($_POST['new_assigned_score'] / $tot_difficult, 2) * $difficult), 2);
                    //$quest_score = (( $_POST['new_assigned_score'] / $tot_difficult ) * $difficult ), 2;
                    break;
                case "1":
                    $quest_score = $quest_obj->getRealMaxScore(round($_POST['new_assigned_score'] / $tot_quest, 2));
                    //$quest_score = round(( $_POST['new_assigned_score'] / $tot_quest ), 2);
                    break;
                case "2":
                    $quest_score = $quest_obj->getMaxScore();
                    break;
            }
        }
        $content = array($i++, $lang->def('_QUEST_ACRN_' . strtoupper($type_quest)), $title_quest);
        if (isset($score_assign)) {
            $content[] = $difficult ? $difficult : '&nbsp;';
            if ($difficult) {
                $content[] = $score_assign[$idQuest] != $_POST['new_score_quest'][$idQuest] ? $score_assign[$idQuest] . '&nbsp;<span class="font_red">*</span>' : $score_assign[$idQuest];
            } else {
                $content[] = '&nbsp;';
            }
        } else {
            $content[] = $difficult ? '<label for="new_difficult_quest_' . $idQuest . '">' . $lang->def('_QUEST_TM2_SETDIFFICULT') . '</label>' . Form::getInputDropdown('', 'new_difficult_quest_' . $idQuest, 'new_difficult_quest[' . $idQuest . ']', array(1 => 1, 2, 3, 4, 5), $difficult, '') : '&nbsp;';
            $content[] = $difficult ? '<label for="new_difficult_quest_' . $idQuest . '">' . $lang->def('_QUEST_TM2_SETSCORE') . '</label>' . '<input type="text" id="new_score_quest_' . $idQuest . '" name="new_score_quest[' . $idQuest . ']" value="' . $quest_score . '" size="5" maxlength="200" alt="' . $lang->def('_QUEST_TM2_SETSCORE') . '" />' : '&nbsp;';
        }
        if ($difficult != 0) {
            $effective_difficult += $difficult;
            if (isset($score_assign)) {
                $effective_tot_score = round($effective_tot_score + $score_assign[$idQuest], 2);
            } else {
                $effective_tot_score = round($effective_tot_score + $quest_score, 2);
            }
        }
        $tab_quest->addBody($content);
    }
    $tab_quest->addBodyCustom('<tr class="line-top-bordered">' . '<td colspan="3" class="align_right">' . $lang->def('TOTAL') . '</td>' . '<td class="align_center">' . $effective_difficult . '</td>' . '<td class="align_center">' . $effective_tot_score . '</td>' . '</tr>');
    $GLOBALS['page']->add($tab_quest->getTable(), 'content');
    //command for this page---------------------------------------------
    if (isset($_POST['new_assigned_score'])) {
        $previous_score = $_POST['new_assigned_score'];
    } else {
        $previous_score = $_POST['previous_score'];
    }
    $score_difference = round($effective_tot_score - $previous_score, 2);
    if ($score_difference < 0) {
        $score_difference = '<strong class="font_red">' . $score_difference . '<strong>';
    } else {
        $score_difference = '<strong>' . $score_difference . '<strong>';
    }
    $GLOBALS['page']->add('</fieldset>', 'content');
    if (!isset($score_assign)) {
        $GLOBALS['page']->add('<div class="set_time_row">' . Form::getHidden('previous_score', 'previous_score', $effective_tot_score) . str_replace('[score_difference]', $score_difference, $lang->def('_QUEST_TM2_SCORE_DIFFERENCE_FROM_PREVIOUS')) . Form::getButton('setpoint', 'setpoint', $lang->def('_PREVIEW'), 'button_nowh') . '</div>' . Form::openButtonSpace() . Form::getButton('saveandexit', 'saveandexit', $lang->def('_SAVE'), 'button') . Form::getButton('back_to_home', 'back_to_home', $lang->def('_UNDO'), 'button') . Form::closeButtonSpace() . '</form>', 'content');
    } else {
        $GLOBALS['page']->add('<div class="set_time_row">' . Form::getHidden('previous_score', 'previous_score', $effective_tot_score) . str_replace('[score_difference]', $score_difference, $lang->def('_QUEST_TM2_SCORE_DIFFERENCE_FROM_PREVIOUS')) . '</div>' . Form::openButtonSpace() . Form::getHidden('point_manual', 'point_assignement', 2) . Form::getButton('setpoint', 'setpoint', $lang->def('_TEST_BACK_TO_SETTIME'), 'button') . Form::getButton('back_to_home', 'back_to_home', $lang->def('_SAVE'), 'button') . Form::closeButtonSpace(), 'content');
    }
    $GLOBALS['page']->add('</div>', 'content');
}
function nl_sendcomplete()
{
    checkPerm('view');
    //-TP// funAdminAccess('OP');
    $out =& $GLOBALS['page'];
    $out->setWorkingZone("content");
    $lang =& DoceboLanguage::createInstance('admin_newsletter', 'framework');
    $out->add(getTitleArea($lang->def("_NEWSLETTER"), "newsletter"));
    $out->add("<div class=\"std_block\">\n");
    $out->add("<br /><b>" . $lang->def("_OPERATION_SUCCESSFUL") . "</b><br /><br />\n");
    $out->add("</div><br />\n");
    $out->add("<form action=\"index.php?modname=public_newsletter_admin&amp;op=newsletter\" method=\"post\">\n" . '<input type="hidden" id="authentic_request_pubr" name="authentic_request" value="' . Util::getSignature() . '" />');
    $out->add("<div class=\"std_block\">\n");
    $out->add("<input class=\"button\" type=\"submit\" value=\"" . $lang->def("_BACK") . "\" />\n");
    $out->add("</div>\n");
    $out->add("</form>\n");
}
示例#14
0
function edit_progtot()
{
    $out =& $GLOBALS['page'];
    $out->setWorkingZone('content');
    $lang =& DoceboLanguage::createInstance('project', "lms");
    // Controllo che l'utente non cerchi di entrare in progetti a cui non e' iscritto.
    $id = $_GET["id"];
    $itemid = importVar("itemid");
    $myprj = user_projects(Docebo::user()->getIdSt());
    $view_perm = checkPerm('view', true);
    if ($view_perm && in_array($id, $myprj) && (is_owner(Docebo::user()->getIdSt(), $id) || is_admin(Docebo::user()->getIdSt(), $id))) {
        //area title
        $out->add(getTitleArea($lang->def("_PROJECT_MANAGER"), "project"));
        $out->add('<div class="std_block">');
        if (isset($_POST["applychanges"])) {
            $progtot = (int) $_POST["progtot"];
            $query = sql_query("UPDATE " . $GLOBALS["prefix_lms"] . "_prj SET pprog='{$progtot}' WHERE id='{$id}' LIMIT 1;");
            @Util::jump_to(" index.php?modname=project&op=showprj&id={$id}");
        }
        $out->add("<form method=\"post\" action=\"index.php?modname=project&amp;op=editprogtot&amp;id={$id}\">\n" . '<input type="hidden" id="authentic_request_prj" name="authentic_request" value="' . Util::getSignature() . '" />');
        // progresso totale: ___%
        $query = sql_query("SELECT * FROM " . $GLOBALS["prefix_lms"] . "_prj WHERE id='{$id}' LIMIT 1;");
        $row = mysql_fetch_array($query);
        $out->add($lang->def("_PRJPROGTOT") . ":\n");
        $out->add("<input type=\"text\" size=\"3\" id=\"progtot\" name=\"progtot\" value=\"" . (int) $row["pprog"] . "\" />%<br /><br />\n");
        $out->add("<input type=\"hidden\" id=\"applychanges\" name=\"applychanges\" value=\"1\" />\n");
        $out->add("<input class=\"button\" type=\"submit\" value=\"" . $lang->def("_SAVE") . "\" />\n");
        $out->add("</form><br />\n");
        //		$out->add("<div align=\"center\"><b>[ <a href=\"index.php?modname=project&amp;op=showprj&amp;id=$id\">".$lang->def("_BACK")."</a> ]</b></div>\n");
        $url = "index.php?modname=project&amp;op=showprj&amp;id=" . $id;
        $out->add(getBackUi($url, $lang->def('_BACK')));
        $out->add('<br /></div>');
    } else {
        die("You can't access");
    }
}
示例#15
0
function move_course()
{
    checkPerm('mod');
    require_once $GLOBALS['where_lms'] . '/admin/modules/category/category.php';
    require_once $GLOBALS['where_lms'] . '/admin/modules/category/tree.category.php';
    require_once $GLOBALS['where_framework'] . '/lib/lib.sessionsave.php';
    require_once $GLOBALS['where_lms'] . '/lib/category/class.categorytree.php';
    $out =& $GLOBALS['page'];
    $lang =& DoceboLanguage::createInstance('course', 'lms');
    $out->add(getTitleArea(array($lang->def('_COURSE'), $lang->def('_MOVE')), 'course') . '<div class="std_block">');
    if (isset($_POST["move_course"])) {
        list($id_course) = each($_POST['move_course']);
    } else {
        $id_course = importVar('id_course', true, 0);
    }
    $categoryDb = new CategoryTree();
    //new TreeDb_CatDb($GLOBALS['prefix_lms'].'_category');
    $treeView = new TreeView_CatView($categoryDb, 'course_category', $lang->def('_CATEGORY'));
    if (isset($_POST[$treeView->_getCancelId()])) {
        Util::jump_to('index.php?modname=course&op=course_list');
    }
    $treeView->parsePositionData($_POST, $_POST, $_POST);
    $treeView->show_action = false;
    if (isset($_POST[$treeView->_getFolderNameId()])) {
        $folderid = $_POST[$treeView->_getFolderNameId()];
    } else {
        $folderid = $treeView->getSelectedFolderId();
    }
    $folder = $treeView->tdb->getFolderById($treeView->getSelectedFolderId());
    $out->add('<form method="post" action="index.php?modname=course&amp;op=move_course">' . '<input type="hidden" id="authentic_request_mc" name="authentic_request" value="' . Util::getSignature() . '" />' . '<input type="hidden" id="id_course" name="id_course" value="' . $id_course . '" />' . '<input type="hidden" id="folderid" name="' . $treeView->_getFolderNameId() . '" value="' . $folderid . '" />');
    $out->add('<input type="hidden" name="folder_id" value="' . $treeView->getSelectedFolderId() . '" />');
    $out->add('<input type="hidden" name="id_course" value="' . $id_course . '" />');
    $out->add('<div>' . $treeView->getFolderPrintName($folder) . '</div>');
    $out->add($treeView->load());
    $out->add(' <img src="' . $treeView->_getMoveImage() . '" alt="' . $treeView->_getMoveAlt() . '" /> ' . '<input type="submit" class="TreeViewAction" value="' . $lang->def("_MOVE") . '"' . ' name="move_course_here" id="move' . $id_course . '" />');
    $out->add(' <img src="' . $treeView->_getCancelImage() . '" alt="' . $treeView->_getCancelAlt() . '" /> ' . '<input type="submit" class="TreeViewAction" value="' . $treeView->_getCancelLabel() . '"' . ' name="' . $treeView->_getCancelId() . '" id="' . $treeView->_getCancelId() . '" />');
    $out->add('</form>' . '</div>');
}
示例#16
0
     $json = new Services_JSON();
     $node_id = Get::req('query', DOTY_INT, 0);
     $result = array();
     $treecat = new Categorytree();
     $re = $treecat->getChildrensById($node_id);
     while (list($idCategory, $idParent, $path, $lev, $left, $right) = sql_fetch_row($re)) {
         $result[] = array('id' => $idCategory, 'label' => end(explode('/', $path)), 'is_leaf' => $right - $left == 1, 'count_content' => '');
         //change this
     }
     aout($json->encode($result));
     break;
 case "getaddnodeform":
     $url = Get::req('server_url', DOTY_ALPHANUM, false);
     $parent_id = Get::req('parent_id', DOTY_ALPHANUM, false);
     $output = array();
     $output['body'] = '<form name="tree_addfolder_form" method="POST" action="' . $url . '">' . '<input type="hidden" id="authentic_request_addfolder" name="authentic_request" value="' . Util::getSignature() . '" />' . '<input type="hidden" name="op" value="add_folder" />' . '<input type="hidden" name="parent_id" value="' . $parent_id . '" />' . '<label for="newname">' . "lang._NEW_FOLDER" . ':</label><input type="text" name="newname" /></form>';
     $json = new Services_JSON();
     aout($json->encode($output));
     break;
 case "add_folder":
     $output = array();
     $output['success'] = true;
     $output['folder_id'] = 666;
     $output['label'] = 'label';
     $output['is_leaf'] = false;
     $json = new Services_JSON();
     aout($json->encode($output));
     break;
 case "add_element":
     break;
 case "del_folder":
示例#17
0
    echo " lms_url: '{$lms_url}',\n";
    echo " lms_base_url: '{$lms_base_url}',\n";
    echo " scormserviceid: '{$scormserviceid}',\n";
    echo " scormVersion: '{$scormVersion}',\n";
    echo " idUser: '******',\n";
    echo " idReference: '{$idReference}',\n";
    echo " idscorm_organization: '{$idscorm_organization}',\n";
    echo " imagesPath: '{$imagesPath}',\n";
    echo " idElemTree: 'treecontent',\n";
    echo " idElemSco: 'scormbody',\n";
    echo " idElemScoContent: 'scocontent',\n";
    echo " idElemSeparator: 'separator',\n ";
    echo " showTree: '{$isshow_tree}',\n ";
    echo " playertemplate: '{$playertemplate}',\n";
    echo " keepalivetmo: '" . $keepalivetmo . "',\n";
    echo " auth_request: '" . Util::getSignature() . "',\n";
    echo " environment: '{$environment}',\n";
    echo " useWaitDialog: '" . Get::sett('use_wait_dialog', "off") . "',\n";
    echo " startFromChapter: " . ($start_from_chapter ? "'" . $start_from_chapter . "'" : "false") . "\n";
    echo "};\n";
    echo 'window.onload = StdUIPlayer.initialize;' . "\n";
    echo ' // -->' . "\n";
    echo '</SCRIPT>' . "\n";
    echo '
		<script type="text/javascript" src=".././addons/yui/utilities/utilities.js"></script>
		<script type="text/javascript" src=".././addons/yui/json/json-min.js"></script>
		<script type="text/javascript" src=".././addons/yui/animation/animation-min.js"></script>
		<script type="text/javascript" src=".././addons/yui/logger/logger-min.js"></script>

		<link rel="stylesheet" type="text/css" href="../templates/standard/yui-skin/logger.css" />';
    echo '</head>' . "\n";
示例#18
0
/**
 * This function can be called from LO insert/edit operation
 * to set position in homerepo and other metadata.
 * @param $lo instance of the learning object to edit
 * @param $withForm print form tag
 * @param $withContents display the Items in folders
 * @param $idLO id of learning object to change. If this parameter is not NULL
 *			$lo is ignored
 **/
function manHomeRepoSave(&$lo, $withForm = FALSE, $withContents = TRUE, $treeView = NULL, $idLO = NULL)
{
    if ($treeView === NULL) {
        $treeView = manHomerepo_CreateTreeView($withContents, FALSE);
    }
    // print a form that submit to the same url
    if ($withForm) {
        echo '<form name="manHomerepo" method="post"' . ' action="index.php?' . $_SERVER['QUERY_STRING'] . '"' . ' >' . "\n" . '<input type="hidden" id="authentic_request_hr" name="authentic_request" value="' . Util::getSignature() . '" />';
    }
    if ($treeView->cancel) {
        if (isset($_POST['idLO'])) {
            Util::jump_to('index.php?modname=homerepo&op=homerepo');
        } else {
            Util::jump_to('' . $lo->getBackUrl());
        }
    }
    // handle operations
    switch ($treeView->op) {
        case 'newfolder':
            manHomerepo_addfolder($treeView);
            break;
        case 'save':
            if (isset($_POST['idLO'])) {
                manHomerepo_update($treeView->getSelectedFolderId(), $_POST['idLO'], $_POST);
                Util::jump_to('index.php?modname=homerepo&op=homerepo');
            } else {
                manHomerepo_save($treeView->getSelectedFolderId(), $lo, $_POST);
                Util::jump_to('' . $lo->getBackUrl());
            }
            break;
        case 'display':
        default:
            echo '<div class="std_block">';
            manHomerepo_display($treeView, $withContents);
            loadFields($_POST, $lo, $idLO);
            // add save button
            echo '<img src="' . $treeView->_getSaveImage() . '" alt="' . _SAVE . '" /> ' . '<input type="submit" value="' . _SAVE . '" class="LVAction"' . ' name="' . $treeView->_getOpSaveFile() . '" />';
            echo ' <img src="' . $treeView->_getCancelImage() . '" alt="' . $treeView->_getCancelAlt() . '" />' . '<input type="submit" class="LVAction" value="' . $treeView->_getCancelLabel() . '"' . ' name="' . $treeView->_getCancelId() . '" id="' . $treeView->_getCancelId() . '" />';
            echo '</div>';
            break;
    }
    if ($withForm) {
        echo '</form>' . "\n";
    }
}
示例#19
0
function modpollgui($object_poll)
{
    checkPerm('view', false, 'storage');
    $lang =& DoceboLanguage::createInstance('poll');
    if (!is_a($object_poll, 'Learning_Poll')) {
        $_SESSION['last_error'] = $lang->def('_POLL_INCORRECTOBJECT');
        Util::jump_to('' . $object_poll->back_url . '&amp;create_result=0');
    }
    require_once _base_ . '/lib/lib.table.php';
    require_once _base_ . '/lib/lib.form.php';
    $url_encode = htmlentities(urlencode($object_poll->back_url));
    list($poll_title) = sql_fetch_row(sql_query("\r\n\tSELECT title \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_poll \r\n\tWHERE id_poll = '" . $object_poll->getId() . "'"));
    $re_quest = sql_query("\r\n\tSELECT id_quest, type_quest, title_quest, sequence, page \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_pollquest \r\n\tWHERE id_poll = '" . $object_poll->getId() . "'\r\n\tORDER BY sequence");
    $num_quest = mysql_num_rows($re_quest);
    list($num_page) = sql_fetch_row(sql_query("\r\n\tSELECT MAX(page) \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_pollquest \r\n\tWHERE id_poll = '" . $object_poll->getId() . "'"));
    $num_page = (int) $num_page;
    $GLOBALS['page']->add(getTitleArea($lang->def('_POLL_SECTION'), 'poll') . '<div class="std_block">' . getBackUi(Util::str_replace_once('&', '&amp;', $object_poll->back_url), $lang->def('_BACK')), 'content');
    if (isset($_GET['mod_operation'])) {
        if ($_GET['mod_operation']) {
            $GLOBALS['page']->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')), 'content');
        } else {
            $GLOBALS['page']->add(getResultUi($lang->def('_QUEST_ERR_MODIFY')), 'content');
        }
    }
    //other areas
    $GLOBALS['page']->add('<b>' . $lang->def('_TITLE') . ' : ' . $poll_title . '</b><br /><br />' . '<div class="mod_container">' . '<a href="index.php?modname=poll&amp;op=modpoll&amp;id_poll=' . $object_poll->getId() . '&amp;back_url=' . $url_encode . '" title="' . $lang->def('_MOD_TITLE') . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD_TITLE') . '" />&nbsp;' . $lang->def('_MOD_TITLE') . '</a>' . '</div><br />', 'content');
    $caption = str_replace('[tot_page]', $num_page, str_replace('[tot_element]', $num_quest, $lang->def('_POLL_CAPTION')));
    $tab = new Table(0, $caption, $lang->def('_POLL_SUMMARY'));
    $tab->setColsStyle(array('image', 'image', '', 'image', 'image', 'image', 'image', 'image'));
    $tab->addHead(array($lang->def('_QUEST'), $lang->def('_TYPE'), $lang->def('_TITLE'), $lang->def('_POLL_QUEST_ORDER'), '<img src="' . getPathImage() . 'standard/down.png" alt="' . $lang->def('_DOWN') . '" longdesc="' . $lang->def('_DOWN') . '" />', '<img src="' . getPathImage() . 'standard/up.png" alt="' . $lang->def('_UP') . '" longdesc="' . $lang->def('_UP') . '" />', '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" longdesc="' . $lang->def('_MOD') . '" />', '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" longdesc="' . $lang->def('_POLL_REMPOLL') . '" />'));
    $i = 0;
    $quest_num = 1;
    $title_num = 1;
    $last_type = '';
    $uri_back = '&amp;back_url=' . $url_encode;
    while (list($id_quest, $type, $title, $sequence, $page) = sql_fetch_row($re_quest)) {
        $last_type = $type;
        $content = array($type != 'break_page' && $type != 'title' ? '<span class="text_bold">' . $quest_num++ . '</span>' : '', $lang->def('_QUEST_ACRN_' . strtoupper($type)), $title, $sequence, $i != $num_quest - 1 ? '<a href="index.php?modname=poll&amp;op=movedown&amp;id_quest=' . $id_quest . $uri_back . '" title="' . $lang->def('_DOWN') . '">' . '<img src="' . getPathImage() . 'standard/down.png" alt="' . $lang->def('_DOWN') . ' : ' . $lang->def('_ROW') . ' ' . ($i + 1) . '" longdesc="' . $lang->def('_DOWN') . '" /></a>' : '', $i != 0 ? '<a href="index.php?modname=poll&amp;op=moveup&amp;id_quest=' . $id_quest . $uri_back . '" title="' . $lang->def('_UP') . '">' . '<img src="' . getPathImage() . 'standard/up.png" alt="' . $lang->def('_UP') . ' : ' . $lang->def('_ROW') . ' ' . ($i + 1) . '" longdesc="' . $lang->def('_UP') . '" /></a>' : '', $type != 'break_page' ? '<a href="index.php?modname=poll&amp;op=modquest&amp;id_quest=' . $id_quest . $uri_back . '" title="' . $lang->def('_MOD') . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . ' : ' . $lang->def('_ROW') . ' ' . ($i + 1) . '" longdesc="' . $lang->def('_MOD') . '" /></a>' : '', '<a href="index.php?modname=poll&amp;op=delquest&amp;id_quest=' . $id_quest . $uri_back . '" title="' . $lang->def('_POLL_REMPOLL') . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . ' : ' . $lang->def('_ROW') . ' ' . ($i + 1) . '" longdesc="' . $lang->def('_POLL_REMPOLL') . '" /></a>');
        $tab->addBody($content);
        ++$i;
    }
    //------------------------------------------------------------------
    if ($num_quest > 1) {
        $move_quest = '<form class="align_right" method="post" action="index.php?modname=poll&amp;op=movequest">' . '<div>' . '<input type="hidden" id="authentic_request_poll" name="authentic_request" value="' . Util::getSignature() . '" />' . '<input type="hidden" name="back_url" value="' . $url_encode . '" />' . '<input type="hidden" name="id_poll" value="' . $object_poll->getId() . '" />';
        $move_quest .= '<label class="text_bold" for="source_quest">' . $lang->def('_MOVE') . '</label>&nbsp;' . '<select id="source_quest" name="source_quest">';
        for ($opt = 1; $opt <= $i; $opt++) {
            $move_quest .= '<option value="' . $opt . '"' . ($opt == 1 ? ' selected="selected"' : '') . '>' . $lang->def('_ROW') . ' ' . $opt . '</option>';
        }
        $move_quest .= '</select>';
        $move_quest .= '<label class="text_bold" for="dest_quest"> ' . $lang->def('_POLL_LABEL_AFTER_QUEST') . '</label>&nbsp;' . '<select id="dest_quest" name="dest_quest">' . '<option value="1" selected="selected">' . $lang->def('_POLL_FIRST_QUEST') . '</option>';
        for ($opt = 1; $opt < $i; $opt++) {
            $move_quest .= '<option value="' . ($opt + 1) . '">' . $lang->def('_POLL_AFTER_QUEST') . ' ' . $opt . '</option>';
        }
        $move_quest .= '<option value="' . ($i + 1) . '">' . $lang->def('_POLL_LAST_QUEST') . '</option>';
        $move_quest .= '</select>';
        $move_quest .= '&nbsp;<input class="button_nowh" type="submit" id="move_quest" name="move_quest" value="' . $lang->def('_MOVE') . '" />' . '</div>' . '</form>';
    } else {
        $move_quest = '';
    }
    //------------------------------------------------------------------
    $re_type = sql_query("\r\n\tSELECT type_quest \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_quest_type_poll \r\n\tORDER BY sequence");
    $add_quest = '<form method="post" action="index.php?modname=poll&amp;op=addquest">' . '<div>' . '<input type="hidden" id="authentic_request_poll" name="authentic_request" value="' . Util::getSignature() . '" />' . '<input type="hidden" name="back_url" value="' . $url_encode . '" />' . '<input type="hidden" name="id_poll" value="' . $object_poll->getId() . '" />';
    $add_quest .= '<label class="text_bold" for="add_poll_quest">' . $lang->def('_POLL_ADDQUEST') . '</label>&nbsp;' . '<select id="add_poll_quest_btm" name="add_poll_quest">';
    while (list($type_quest) = sql_fetch_row($re_type)) {
        $add_quest .= '<option value="' . $type_quest . '"' . ($last_type == $type_quest ? ' selected="selected"' : '') . '>' . $lang->def('_QUEST_ACRN_' . strtoupper($type_quest)) . ' - ' . $lang->def('_QUEST_' . strtoupper($type_quest)) . '</option>';
    }
    $add_quest .= '</select>';
    $add_quest .= '&nbsp;<input id="add_quest_btm" class="button_nowh" type="submit" name="add_quest" value="' . $lang->def('_ADD') . '" />' . '</div>' . '</form>';
    //------------------------------------------------------------------
    //$tab->addActionAdd( $add_quest );
    $GLOBALS['page']->add($tab->getTable() . '<div class="table-container-below">' . $move_quest . '</div>', 'content');
    $GLOBALS['page']->add('<div class="table-container-below">' . $add_quest . '</div>', 'content');
    $GLOBALS['page']->add(' <a href="index.php?modname=poll&amp;op=fixsequence&amp;id_poll=' . $object_poll->getId() . $uri_back . '">' . $lang->def('_FIX_SEQUENCE', 'test') . '</a>', 'content');
    $GLOBALS['page']->add(getBackUi(Util::str_replace_once('&', '&amp;', $object_poll->back_url), $lang->def('_BACK')) . '</div>', 'content');
    $GLOBALS['page']->add('
	<script type="text/javascript">
	YAHOO.util.Event.addListener(window, "load", function() {
		var oMoveQuest = new YAHOO.widget.Button("move_quest");
		var oSplitAddQuestBtm = new YAHOO.widget.Button("add_quest_btm", { type: "menu", menu: "add_poll_quest_btm" });
	});
	</script>', 'content');
    //fixPageSequence($object_poll->getId());
}