/**
  * 
  * @return EfrontCache
  */
 public static function getInstance()
 {
     if (is_null(self::$_instance)) {
         if (function_exists('apc_store')) {
             self::$_instance = EfrontCache::factory('apc');
         } else {
             if (function_exists('wincache_ucache_set')) {
                 self::$_instance = EfrontCache::factory('wincache');
             } else {
                 self::$_instance = EfrontCache::factory('db');
             }
         }
     }
     return self::$_instance;
 }
 private function doChangeLogin()
 {
     $smarty = $this->getSmartyVar();
     $currentUser = $this->getCurrentUser();
     $form = new HTML_QuickForm("change_login_form", "post", basename($_SERVER['PHP_SELF']) . "?ctg=module&op=module_administrator_tools&do=user", "", null, true);
     $form->addElement('static', 'sidenote', '<img id = "module_administrator_tools_busy" src = "images/16x16/clock.png" style="display:none;" alt = "' . _LOADING . '" title = "' . _LOADING . '"/>');
     $form->addElement('text', 'selection_user', _MODULE_ADMINISTRATOR_TOOLS_SELECTUSERTOCHANGELOGINFOR, 'id = "module_administrator_tools_autocomplete_users" class = "autoCompleteTextBox" style = "width:400px"');
     $form->addElement('static', 'autocomplete_note', _STARTTYPINGFORRELEVENTMATCHES);
     $form->addElement('text', 'new_login', _MODULE_ADMINISTRATOR_TOOLS_NEWLOGIN, 'class = "inputText"');
     $form->addElement('hidden', 'users_LOGIN', '', 'id="module_administrator_tools_users_LOGIN"');
     $form->registerRule('checkParameter', 'callback', 'eF_checkParameter');
     $form->addRule('selection_user', _THEFIELD . ' "' . _USER . '" ' . _ISMANDATORY, 'required', null, 'client');
     $form->addRule('users_LOGIN', _MODULE_ADMINISTRATOR_TOOLS_THISUSERWASNOTFOUND, 'required', null, 'client');
     $form->addRule('new_login', _THEFIELD . ' ' . _MODULE_ADMINISTRATOR_TOOLS_NEWLOGIN . ' ' . _HASINVALIDCHARACTERS . '. ' . _ONLYALLOWEDCHARACTERSLOGIN, 'checkParameter', 'login');
     $form->addElement('submit', 'submit', _SUBMIT, 'class = "flatButton"');
     if ($form->isSubmitted() && $form->validate()) {
         try {
             $values = $form->exportValues();
             if (!$values['new_login']) {
                 throw new Exception(_MODULE_ADMINISTRATOR_TOOLS_YOUMUSTDEFINEUSER);
             }
             $user = EfrontUserFactory::factory($values['users_LOGIN']);
             try {
                 $existingUser = true;
                 if (strcasecmp($values['new_login'], $values['users_LOGIN']) === 0) {
                     //Allow changing same user, for case conversions etc
                     $existingUser = false;
                 } else {
                     $newUser = EfrontUserFactory::factory($values['new_login']);
                 }
             } catch (Exception $e) {
                 $existingUser = false;
             }
             if ($existingUser) {
                 throw new Exception(_MODULE_ADMINISTRATOR_TOOLS_USERALREADYEXISTS);
             }
             $existingTables = $GLOBALS['db']->GetCol("show tables");
             $views = $GLOBALS['db']->GetCol("show tables like '%_view'");
             $errors = array();
             foreach ($existingTables as $table) {
                 try {
                     if (!in_array($table, $views)) {
                         $this->changeLogin($table, $values['users_LOGIN'], $values['new_login']);
                     }
                 } catch (Exception $e) {
                     $errors[] = $e->getMessage();
                 }
             }
             EfrontCache::getInstance()->deleteCache('usernames');
             if (empty($errors)) {
                 $message = _OPERATIONCOMPLETEDSUCCESSFULLY;
                 $message_type = 'success';
             } else {
                 $message = _MODULE_ADMINISTRATOR_TOOLS_OPERATIONCOMPLETEDSUCCESSFULLYBUTHEFOLLOWINGTABLESCOULDNOTBEUPDATED . ': <br>' . implode("<br>", $errors);
                 $message_type = 'failure';
             }
         } catch (Exception $e) {
             $smarty->assign("T_EXCEPTION_TRACE", $e->getTraceAsString());
             $message = $e->getMessage() . ' (' . $e->getCode() . ') &nbsp;<a href = "javascript:void(0)" onclick = "eF_js_showDivPopup(event, \'' . _ERRORDETAILS . '\', 2, \'error_details\')">' . _MOREINFO . '</a>';
             $message_type = 'failure';
         }
         $this->setMessageVar($message, $message_type);
     }
     $smarty->assign("T_TOOLS_FORM", $form->toArray());
     try {
         if (isset($_GET['ajax']) && isset($_GET['user']) && eF_checkParameter($_GET['user'], 'login')) {
             $user = EfrontUserFactory::factory($_GET['user']);
             echo json_encode(array('status' => 1, 'supervisors' => $supervisors, 'supervisor_names' => $supervisorNames));
             exit;
         } elseif (isset($_GET['ajax']) && $_GET['ajax'] == 'fix_case') {
             $existingTables = $GLOBALS['db']->GetCol("show tables");
             $views = $GLOBALS['db']->GetCol("show tables like '%_view'");
             $users = eF_getTableDataFlat("users", "login");
             $errors = array();
             foreach ($existingTables as $table) {
                 $t = microtime(true);
                 try {
                     if (!in_array($table, $views)) {
                         $fields = $GLOBALS['db']->GetCol("describe {$table}");
                         foreach ($users['login'] as $key => $login) {
                             foreach ($fields as $value) {
                                 if (stripos($value, 'login') !== false) {
                                     eF_executeNew("update {$table} set {$value}='{$login}' where {$value}='{$login}'");
                                 }
                             }
                             if ($table == 'f_personal_messages') {
                                 eF_updateTableData($table, array("sender" => $login), "sender = '" . $login . "'");
                             }
                             if ($table == 'notifications' || $table == 'sent_notifications') {
                                 eF_updateTableData($table, array("recipient" => $login), "recipient = '" . $login . "'");
                             }
                             if ($table == 'surveys' || $table == 'module_hcd_events') {
                                 eF_updateTableData($table, array("author" => $login), "author = '" . $login . "'");
                             }
                         }
                     }
                 } catch (Exception $e) {
                     $errors[] = $e->getMessage();
                 }
                 //pr("Time for $table: ".(microtime(true)-$t));flush();ob_flush();
             }
             EfrontCache::getInstance()->deleteCache('usernames');
             echo json_encode(array('status' => 1));
             exit;
         }
     } catch (Exception $e) {
         handleAjaxExceptions($e);
     }
 }
示例#3
0
     EfrontCache::getInstance()->deleteCache('modules');
     exit;
 } elseif (isset($_GET['activate_module']) && eF_checkParameter($_GET['activate_module'], 'filename')) {
     if (isset($currentUser->coreAccess['modules']) && $currentUser->coreAccess['modules'] != 'change') {
         throw new EfrontSystemException(_UNAUTHORIZEDACCESS, EfrontSystemException::UNAUTHORIZED_ACCESS);
     }
     eF_updateTableData("modules", array("active" => 1), "className = '" . $_GET['activate_module'] . "'");
     EfrontCache::getInstance()->deleteCache('modules');
     echo "1";
     exit;
 } elseif (isset($_GET['deactivate_module']) && eF_checkParameter($_GET['deactivate_module'], 'filename')) {
     if (isset($currentUser->coreAccess['modules']) && $currentUser->coreAccess['modules'] != 'change') {
         throw new EfrontSystemException(_UNAUTHORIZEDACCESS, EfrontSystemException::UNAUTHORIZED_ACCESS);
     }
     eF_updateTableData("modules", array("active" => 0), "className = '" . $_GET['deactivate_module'] . "'");
     EfrontCache::getInstance()->deleteCache('modules');
     echo "0";
     exit;
 } elseif (isset($_GET['install_module']) && eF_checkParameter($_GET['install_module'], 'filename')) {
     $module_folder = $_GET['install_module'];
     $module_position = $module_folder;
     if (is_file(G_MODULESPATH . $module_folder . '/module.xml')) {
         $xml = simplexml_load_file(G_MODULESPATH . $module_folder . '/module.xml');
         $className = (string) $xml->className;
         $className = str_replace(" ", "", $className);
         $database_file = (string) $xml->database;
         if (is_file(G_MODULESPATH . $module_folder . '/' . $className . ".class.php")) {
             $module_exists = 0;
             // Do not check for module existence if the module is to be upgraded
             if (!isset($_GET['upgrade'])) {
                 foreach ($modulesList as $module) {
示例#4
0
 $form->addElement('submit', 'submit_import', _SUBMIT, 'class = "flatButton"');
 $smarty->assign("T_MAX_FILESIZE", FileSystemTree::getUploadMaxSize());
 if ($form->isSubmitted() && $form->validate()) {
     try {
         $values = $form->exportValues();
         $basedir = G_THEMESPATH . $layoutTheme->themes['path'] . 'external/';
         $filesystem = new FileSystemTree($basedir);
         $uploadedFile = $filesystem->uploadFile('file_upload', $basedir);
         $uploadedFile->uncompress();
         $uploadedFile->delete();
         $settings = file_get_contents($basedir . 'layout_settings.php.inc');
         if ($settings = unserialize($settings)) {
             $layoutTheme->layout = $settings;
             $layoutTheme->persist();
         }
         EfrontCache::getInstance()->delete(G_DBNAME . ':themes');
         eF_redirect(basename($_SERVER['PHP_SELF']) . "?ctg=themes&theme=" . $layoutTheme->{$layoutTheme->entity}['id'] . (isset($_GET['theme_layout']) ? '&theme_layout=' . $_GET['theme_layout'] : '') . "&message=" . rawurlencode(_SETTINGSIMPORTEDSUCCESFULLY) . "&message_type=success");
         //$message      = _SETTINGSIMPORTEDSUCCESFULLY;
         //$message_type = 'success';
     } catch (Exception $e) {
         handleNormalFlowExceptions($e);
     }
 }
 $renderer = new HTML_QuickForm_Renderer_ArraySmarty($smarty);
 $form->accept($renderer);
 $smarty->assign('T_IMPORT_SETTINGS_FORM', $renderer->toArray());
 $blocks = array('login' => _LOGINENTRANCE, 'online' => _USERSONLINE, 'lessons' => _LESSONS, 'selectedLessons' => _SELECTEDLESSONS, 'news' => _SYSTEMNEWS, 'links' => _MENU, 'checker' => _OPTIONSCHECKER);
 foreach ($customBlocks as $key => $block) {
     $blocks[$key] = htmlspecialchars($block['title'], ENT_QUOTES);
 }
 $smarty->assign("T_BLOCKS", json_encode($blocks));
 /**
  * Return a list of all calendar events that should be presented to the user
  * Administrators view all events, except for private events for other users
  *
  * @param mixed $user A user login or an EfrontUser object
  * @return array A list of calendar events
  * @since 3.6.7
  * @access public
  * @static
  */
 public static function getCalendarEventsForUser($user)
 {
     if (!$user instanceof EfrontUser) {
         $user = EfrontUserFactory::factory($user);
     }
     $parameters = "calendar:{$user->user['login']}";
     if (($events = EfrontCache::getInstance()->getCache($parameters)) !== false) {
         $events = unserialize($events);
     } else {
         if ($user->user['user_type'] == 'administrator') {
             $events = self::getCalendarEventsForAdministrator($user);
         } else {
             $events = self::getCalendarEventsForNonAdministrator($user);
         }
         EfrontCache::getInstance()->setCache($parameters, serialize($events), 86400);
     }
     return $events;
 }
示例#6
0
 /**
  *
  * @return unknown_type
  */
 public static function getAll()
 {
     $themes = EfrontCache::getInstance()->getCache('themes');
     if (!$themes) {
         $themes = parent::getAll("themes", true);
         EfrontCache::getInstance()->setCache('themes', $themes);
     }
     return $themes;
 }
示例#7
0
 public static function setLogoFile($currentTheme)
 {
     $logo = EfrontCache::getInstance()->getCache('logo');
     if (!$logo) {
         try {
             if ($GLOBALS['configuration']['use_logo'] == 2 && defined('G_BRANCH_URL') && G_BRANCH_URL && is_file(G_CURRENTTHEMEPATH . 'images/logo/logo.png')) {
                 $logo = 'images/logo/logo.png';
             } else {
                 if ($GLOBALS['configuration']['use_logo'] == 2 && is_file(G_CURRENTTHEMEPATH . 'images/logo/logo.png')) {
                     $logo = 'images/logo/logo.png';
                 } else {
                     if ($GLOBALS['configuration']['use_logo'] > 0) {
                         //meaning that either we have 'use site logo' (1) or 'use theme logo' (2) but that does not exist
                         $logoFile = new EfrontFile($GLOBALS['configuration']['site_logo']);
                         $logo = 'themes/default/images/logo/' . $logoFile['physical_name'];
                     } else {
                         $logo = 'images/logo.png';
                     }
                 }
             }
         } catch (EfrontFileException $e) {
             $logo = "images/logo.png";
         }
         EfrontCache::getInstance()->setCache('logo', $logo);
     }
     return $logo;
 }
示例#8
0
 protected function updateExistingData($line, $type, $data)
 {
     $this->cleanUpEmptyValues($data);
     try {
         switch ($type) {
             case "users":
                 if (isset($data['password']) && $data['password'] != "" && $data['password'] != "ldap") {
                     $data['password'] = EfrontUser::createPassword($data['password']);
                 }
                 eF_updateTableData("users", $data, "login='******'login'] . "'");
                 $this->log["success"][] = _LINE . " {$line}: " . _REPLACEDUSER . " " . $data['login'];
                 EfrontCache::getInstance()->deleteCache('usernames');
                 break;
             case "users_to_courses":
                 $where = "users_login='******'users_login'] . "' AND courses_ID = " . $data['courses_ID'];
                 EfrontCourse::persistCourseUsers($data, $where, $data['courses_ID'], $data['users_login']);
                 $this->log["success"][] = _LINE . " {$line}: " . _REPLACEDEXISTINGASSIGNMENT;
                 break;
             case "users_to_lessons":
                 eF_updateTableData("users_to_lessons", $data, "users_login='******'users_login'] . "' AND lessons_ID = " . $data['lessons_ID']);
                 $this->log["success"][] = _LINE . " {$line}: " . _REPLACEDEXISTINGASSIGNMENT;
                 break;
             case "users_to_groups":
                 break;
                 #cpp#ifdef ENTERPRISE
             #cpp#ifdef ENTERPRISE
             case "employees":
                 eF_updateTableData("module_hcd_employees", $data, "users_login='******'users_login'] . "'");
                 $this->log["success"][] = _LINE . " {$line}: " . _REPLACEDUSER . " " . $data['users_login'];
                 break;
             case "branches":
                 eF_updateTableData("module_hcd_branch", $data, "branch_ID ='" . $data['branch_ID'] . "'");
                 $this->log["success"][] = _LINE . " {$line}: " . _REPLACEDEXISTINGBRANCH . " " . $data['name'];
                 break;
             case "job_descriptions":
                 if ($data['branch_ID'] != "all") {
                     $branch_condition = " AND branch_ID = " . $data['branch_ID'];
                 }
                 eF_updateTableData("module_hcd_job_description", $data, "description ='" . $data['job_description_ID'] . "' " . $branch_condition);
                 $this->log["success"][] = _LINE . " {$line}: " . _REPLACEDEXISTINGJOB . " " . $data['description'];
                 break;
             case "skills":
                 eF_updateTableData("module_hcd_skills", $data, "skill_ID ='" . $data['skill_ID'] . "'");
                 $this->log["success"][] = _LINE . " {$line}: " . _REPLACEDEXISTINGSKILL . " " . $data['description'];
                 break;
             case "users_to_jobs":
                 // Done in importData to avoid re-creating the same objects
             // Done in importData to avoid re-creating the same objects
             case "users_to_skills":
                 // Done automatically in importData by $skill->assignToUser
                 break;
             case "courses_to_branches":
                 //
                 break;
                 #cpp#endif
         }
     } catch (Exception $e) {
         $this->log["failure"][] = _LINE . " {$line}: " . $e->getMessage();
     }
 }
示例#9
0
    /**
     *
     * @param unknown_type $file
     * @return unknown_type
     */
    public static function import($lesson, $manifestFile, $scormFolderName, $parameters, $iframe_parameters)
    {
        if ($lesson instanceof EfrontLesson) {
            $currentLesson = $lesson;
        } else {
            $currentLesson = new EfrontLesson($lesson);
        }
        $lessons_ID = $currentLesson->lesson['id'];
        $currentContent = new EfrontContentTree($currentLesson);
        $manifestXML = file_get_contents($manifestFile['path']);
        $tagArray = EfrontScorm::parseManifest($manifestXML);
        if (G_VERSIONTYPE != 'community') {
            #cpp#ifndef COMMUNITY
            if (G_VERSIONTYPE != 'standard') {
                #cpp#ifndef STANDARD
                /**
                 * We must merge sequencingCollection general rules with local sequencing rules
                 * The rule is the following: There can be 0 or 1 <imsss:sequencingCollection> tags in the end of the manifest.
                 * If one exists, it may contain 1 or more <imsss:sequencing> tags, each with an ID, like:
                 * <imsss:sequencing ID = "seqCol-CM07d-1">
                 * Each of these will contain inner rules, for example:
                 *   <imsss:sequencing ID = "seqCol-CM07d-3">
                 *		<imsss:limitConditions attemptLimit="1"/>
                 *      <imsss:rollupRules rollupObjectiveSatisfied="false"/>
                 *   </imsss:sequencing>
                 * Now, for every <item> element in the manifest, there may be inline <imsss:sequencing> declarations. These may specify
                 * <imsss:XXX> rules like above, that have local scope, or they may be having the IDRef attribute, pointing to a sequencingCollection's
                 * <imsss:sequencing>, or both. In the last case, the <imsss:XXX> rules must be merged for each item. In the case that a rule exists
                 * in both parts, the inline <item>'s rule takes precedence.
                 *
                 * The code below does this merge:
                 * 1. Parse the manifest array to find the general <sequencingCollection> rules.
                 * 2. Get all the rules contained in the collection, in an ID => <imsss rules> array
                 * 3. Walk through the manifest array to find all <item> elements that reference an ID. Get the existing <imsss> rules it might
                 *    have. Merge the general collection rules with local, but bypass those that already exist
                 *
                 */
                //$collections array holds the sequencing tags that are in the manifest, as keys in the array
                $collections = array();
                foreach ($tagArray as $key => $value) {
                    if (strcasecmp($value['tag'], 'IMSSS:SEQUENCINGCOLLECTION') === 0) {
                        $sequencingCollection = $key;
                        $collections = array_merge($collections, $value['children']);
                    }
                }
                //$rules is an array that holds subarrays, where each has a key that is the ID (for example, 'seqCol-CM07d-3')
                //and its values are the keys of the rules, for example array(132,133,134)
                $rules = array();
                foreach ($collections as $key => $sequencing) {
                    $node = $tagArray[$sequencing];
                    $id = EfrontContentTreeSCORM::form_id($node['attributes']['ID']);
                    $rules[$id] = $node['children'];
                }
                //Parse the manifest to get the <imsss:sequencing> rules (that are not inside the $collections)
                foreach ($tagArray as $key => $value) {
                    if (strcasecmp($value['tag'], 'IMSSS:SEQUENCING') === 0 && !in_array($key, $collections)) {
                        //Check whether this rule references an item in the collection
                        if (in_array(EfrontContentTreeSCORM::form_id($id), array_keys($rules))) {
                            $tagArray[] = array('tag' => 'IMSSS:SEQUENCING', 'parent_index' => $value['parent_index']);
                            //end($tagArray);
                            //$tagArray[$key]['children'][] = key($tagArray);
                            //Get the existing rules of the sequencing, to compare them later with referenced ones
                            $existingRules = array();
                            foreach ($value['children'] as $inrule) {
                                $existingRules[] = $tagArray[$inrule]['tag'];
                            }
                            //echo "<br>----------Existing----------------<br>";
                            //pr($existingRules);
                            //Compare referenced rules with local. If they don't overlap, create a new node in the tagArray, and set him to be
                            //referenced by the item's sequencing
                            //echo "<br>----------Collection----------------<br>";
                            //pr($rules);
                            //pr($existingRules);
                            foreach ($rules[$value['attributes']['IDREF']] as $rule) {
                                if (!in_array($tagArray[$rule]['tag'], $existingRules)) {
                                    self::copyNodeChildren($tagArray, $rule, $key);
                                    /*
                                    $newRule = $tagArray[$rule];
                                    $newRule['parent_index'] = $key;
                                    $tagArray[] = $newRule;
                                    end($tagArray);
                                    $tagArray[$key]['children'][] = key($tagArray);
                                    */
                                    /*
                                    $part1 = (array_slice($tagArray, 0, $count, true));
                                    $part2 = (array_slice($tagArray, $count, -1, true));
                                    $tagArray = ($part1 + array($k => $tagArray[$k]) + $part2);
                                    */
                                }
                            }
                        }
                    }
                }
                /**
                 * We need to unset all the sequencingCollection rules, since they tend to mess up with <item>'s rules in
                 * complete XML parsing below. So, this piece of code finds the sequencingCollection (1 at most), and recursively
                 * unsets it and all of its children from the $tagArray, as if they never existed.
                 */
                if ($sequencingCollection) {
                    $removeNode = $tagArray[$sequencingCollection];
                    $children = array($sequencingCollection);
                    $count = 1;
                    while (sizeof($children) > 0 && $count < 1000) {
                        $children = array_merge($children, $removeNode['children']);
                        $removeNode = $tagArray[$children[$count]];
                        unset($tagArray[$children[$count++]]);
                    }
                    unset($tagArray[$sequencingCollection]);
                }
            }
            #cpp#endif
        }
        #cpp#endif
        /**
         * Now parse XML file as usual
         */
        foreach ($tagArray as $key => $value) {
            $fields = array();
            switch ($value['tag']) {
                case 'SCHEMAVERSION':
                    $scormVersion = $value['value'];
                    if (stripos($scormVersion, '2004') !== false && (G_VERSIONTYPE == 'community' || G_VERSIONTYPE == 'standard')) {
                        //This additional line is used in case we have the community edition
                        throw new EfrontContentException(_SCORM2004NOTSUPPORTED, EfrontContentException::UNSUPPORTED_CONTENT);
                    }
                    if (G_VERSIONTYPE != 'community') {
                        #cpp#ifndef COMMUNITY
                        if (G_VERSIONTYPE != 'standard') {
                            #cpp#ifndef STANDARD
                            $scorm2004 = in_array($scormVersion, EfrontContentTreeSCORM::$scorm2004Versions);
                        }
                        #cpp#endif
                    }
                    #cpp#endif
                    break;
                case 'TITLE':
                    $cur = $value['parent_index'];
                    $total_fields[$cur]['name'] = $value['value'] ? $value['value'] : " ";
                    break;
                case 'ORGANIZATION':
                    $item_key = $key;
                    if ($scorm2004) {
                        $total_fields[$key]['lessons_ID'] = $lessons_ID;
                        $total_fields[$key]['timestamp'] = time();
                        $total_fields[$key]['ctg_type'] = 'scorm';
                        $total_fields[$key]['active'] = 1;
                        $total_fields[$key]['scorm_version'] = $scormVersion;
                        $total_fields[$key]['identifier'] = $value['attributes']['IDENTIFIER'];
                        $organizations[$key]['id'] = $value['attributes']['IDENTIFIER'];
                        $organizations[$key]['structure'] = $value['attributes']['STRUCTURE'];
                        $organizations[$key]['objectives_global_to_system'] = $value['attributes']['ADLSEQ:OBJECTIVESGLOBALTOSYSTEM'];
                        $organizations[$key]['shared_data_global_to_system'] = $value['attributes']['ADLCP:SHAREDDATAGLOBALTOSYSTEM'];
                        $organization = $value['attributes']['IDENTIFIER'];
                        $hide_lms_ui[$key]['is_visible'] = $value['attributes']['ISVISIBLE'];
                        $content_to_organization[$item_key] = $organization;
                    }
                    break;
                case 'ITEM':
                    $item_key = $key;
                    $total_fields[$key]['lessons_ID'] = $lessons_ID;
                    $total_fields[$key]['timestamp'] = time();
                    $total_fields[$key]['ctg_type'] = 'scorm';
                    $total_fields[$key]['active'] = 1;
                    $total_fields[$key]['scorm_version'] = $scormVersion;
                    $total_fields[$key]['identifier'] = $value['attributes']['IDENTIFIER'];
                    $hide_lms_ui[$key]['is_visible'] = $value['attributes']['ISVISIBLE'];
                    if ($scorm2004) {
                        $references[$key]['IDENTIFIERREF'] = EfrontContentTreeSCORM::form_id($value['attributes']['IDENTIFIERREF']);
                        /*SCORM 2004: params in element items must be appended to the url*/
                        $references[$key]['PARAMETERS'] = $value['attributes']['PARAMETERS'];
                    } else {
                        $references[$key]['IDENTIFIERREF'] = $value['attributes']['IDENTIFIERREF'];
                        $references[$key]['PARAMETERS'] = $value['attributes']['PARAMETERS'];
                    }
                    $content_to_organization[$item_key] = $organization;
                    break;
                case 'RESOURCE':
                    if ($scorm2004) {
                        $resources[$key] = EfrontContentTreeSCORM::form_id($value['attributes']['IDENTIFIER']);
                    } else {
                        $resources[$key] = $value['attributes']['IDENTIFIER'];
                    }
                    break;
                case 'FILE':
                    $files[$key] = $value['attributes']['HREF'];
                    break;
                case 'ADLCP:MAXTIMEALLOWED':
                    $maxtimeallowed[$key] = $value['value'];
                    break;
                case 'ADLCP:TIMELIMITACTION':
                    $timelimitaction[$key] = $value['value'];
                    break;
                case 'ADLCP:MASTERYSCORE':
                    $masteryscore[$key] = $value['value'];
                    break;
                case 'ADLCP:DATAFROMLMS':
                    $datafromlms[$key] = $value['value'];
                    break;
                case 'ADLCP:PREREQUISITES':
                    $prerequisites[$key] = $value['value'];
                    break;
                case 'ADLCP:COMPLETIONTHRESHOLD':
                    $completion_threshold[$item_key][$key]['min_progress_measure'] = $value['attributes']['MINPROGRESSMEASURE'];
                    $completion_threshold[$item_key][$key]['completed_by_measure'] = $value['attributes']['COMPLETEDBYMEASURE'];
                    $completion_threshold[$item_key][$key]['progress_weight'] = $value['attributes']['PROGRESSWEIGHT'];
                    break;
                case 'IMSSS:SEQUENCING':
                    $item_key = $value['parent_index'];
                    break;
                case 'IMSSS:LIMITCONDITIONS':
                    $limit_conditions[$item_key][$key]['attempt_limit'] = $value['attributes']['ATTEMPTLIMIT'];
                    $limit_conditions[$item_key][$key]['attempt_absolute_duration_limit'] = $value['attributes']['ATTEMPTABSOLUTEDURATIONLIMIT'];
                    break;
                case 'IMSSS:ROLLUPRULES':
                    $rollup_controls[$item_key][$key]['rollup_objective_satisfied'] = $value['attributes']['ROLLUPOBJECTIVESATISFIED'];
                    $rollup_controls[$item_key][$key]['rollup_objective_measure_weight'] = $value['attributes']['OBJECTIVEMEASUREWEIGHT'];
                    $rollup_controls[$item_key][$key]['rollup_progress_completion'] = $value['attributes']['ROLLUPPROGRESSCOMPLETION'];
                    break;
                case 'ADLSEQ:ROLLUPCONSIDERATIONS':
                    $rollup_considerations[$item_key][$key]['required_for_satisfied'] = $value['attributes']['REQUIREDFORSATISFIED'];
                    $rollup_considerations[$item_key][$key]['required_for_not_satisfied'] = $value['attributes']['REQUIREDFORNOTSATISFIED'];
                    $rollup_considerations[$item_key][$key]['required_for_completed'] = $value['attributes']['REQUIREDFORCOMPLETED'];
                    $rollup_considerations[$item_key][$key]['required_for_incomplete'] = $value['attributes']['REQUIREDFORINCOMPLETE'];
                    $rollup_considerations[$item_key][$key]['measure_satisfaction_if_active'] = $value['attributes']['MEASURESATISFACTIONIFACTIVE'];
                    break;
                case 'IMSSS:PRECONDITIONRULE':
                    $cond_key = $key;
                    $rule_conditions[$item_key][$cond_key]['rule_type'] = 0;
                    break;
                case 'IMSSS:POSTCONDITIONRULE':
                    $cond_key = $key;
                    $rule_conditions[$item_key][$cond_key]['rule_type'] = 1;
                    break;
                case 'IMSSS:EXITCONDITIONRULE':
                    $cond_key = $key;
                    $rule_conditions[$item_key][$cond_key]['rule_type'] = 2;
                    break;
                case 'IMSSS:RULECONDITIONS':
                    $rule_conditions[$item_key][$cond_key]['condition_combination'] = $value['attributes']['CONDITIONCOMBINATION'];
                    break;
                case 'IMSSS:RULEACTION':
                    $rule_conditions[$item_key][$cond_key]['rule_action'] = $value['attributes']['ACTION'];
                    break;
                case 'IMSSS:RULECONDITION':
                    $rule_condition[$cond_key][$key]['referenced_objective'] = $value['attributes']['REFERENCEDOBJECTIVE'];
                    $rule_condition[$cond_key][$key]['measure_threshold'] = $value['attributes']['MEASURETHRESHOLD'];
                    $rule_condition[$cond_key][$key]['operator'] = $value['attributes']['OPERATOR'];
                    $rule_condition[$cond_key][$key]['condition'] = $value['attributes']['CONDITION'];
                    break;
                case 'IMSSS:PRIMARYOBJECTIVE':
                    $obj_key = $key;
                    $objective_ID = $value['attributes']['OBJECTIVEID'];
                    $objective[$item_key][$obj_key]['is_primary'] = '1';
                    $objective[$item_key][$obj_key]['satisfied_by_measure'] = $value['attributes']['SATISFIEDBYMEASURE'];
                    /*
                    if($objective_ID == '') {
                    $objective_ID = 'empty_obj_id';
                    }
                    */
                    $objective[$item_key][$obj_key]['objective_ID'] = $objective_ID;
                    //pr($objective);
                    break;
                case 'IMSSS:OBJECTIVE':
                    $obj_key = $key;
                    $objective_ID = $value['attributes']['OBJECTIVEID'];
                    $objective[$item_key][$obj_key]['is_primary'] = '0';
                    $objective[$item_key][$obj_key]['satisfied_by_measure'] = $value['attributes']['SATISFIEDBYMEASURE'];
                    $objective[$item_key][$obj_key]['objective_ID'] = $value['attributes']['OBJECTIVEID'];
                    break;
                case 'IMSSS:MINNORMALIZEDMEASURE':
                    $objective[$item_key][$obj_key]['min_normalized_measure'] = $value['value'];
                    break;
                case 'IMSSS:MAPINFO':
                    $map_info[$item_key][$key]['objective_ID'] = $objective_ID;
                    $map_info[$item_key][$key]['target_objective_ID'] = $value['attributes']['TARGETOBJECTIVEID'];
                    $map_info[$item_key][$key]['read_satisfied_status'] = $value['attributes']['READSATISFIEDSTATUS'];
                    $map_info[$item_key][$key]['read_normalized_measure'] = $value['attributes']['READNORMALIZEDMEASURE'];
                    $map_info[$item_key][$key]['write_satisfied_status'] = $value['attributes']['WRITESATISFIEDSTATUS'];
                    $map_info[$item_key][$key]['write_normalized_measure'] = $value['attributes']['WRITENORMALIZEDMEASURE'];
                    break;
                case 'ADLSEQ:OBJECTIVE':
                    $objective_ID = $value['attributes']['OBJECTIVEID'];
                    break;
                case 'ADLSEQ:MAPINFO':
                    $adl_seq_map_info[$item_key][$key]['objective_ID'] = $objective_ID;
                    $adl_seq_map_info[$item_key][$key]['target_objective_ID'] = $value['attributes']['TARGETOBJECTIVEID'];
                    $adl_seq_map_info[$item_key][$key]['read_raw_score'] = $value['attributes']['READRAWSCORE'];
                    $adl_seq_map_info[$item_key][$key]['read_min_score'] = $value['attributes']['READMINSCORE'];
                    $adl_seq_map_info[$item_key][$key]['read_max_score'] = $value['attributes']['READMAXSCORE'];
                    $adl_seq_map_info[$item_key][$key]['read_completion_status'] = $value['attributes']['READCOMPLETIONSTATUS'];
                    $adl_seq_map_info[$item_key][$key]['read_progress_measure'] = $value['attributes']['READPROGRESSMEASURE'];
                    $adl_seq_map_info[$item_key][$key]['write_raw_score'] = $value['attributes']['WRITERAWSCORE'];
                    $adl_seq_map_info[$item_key][$key]['write_min_score'] = $value['attributes']['WRITEMINSCORE'];
                    $adl_seq_map_info[$item_key][$key]['write_max_score'] = $value['attributes']['WRITEMAXSCORE'];
                    $adl_seq_map_info[$item_key][$key]['write_completion_status'] = $value['attributes']['WRITECOMPLETIONSTATUS'];
                    $adl_seq_map_info[$item_key][$key]['write_progress_measure'] = $value['attributes']['WRITEPROGRESSMEASURE'];
                    break;
                case 'IMSSS:ROLLUPRULE':
                    $rollup_rule_key = $key;
                    $rollup_rules[$item_key][$key]['child_activity_set'] = $value['attributes']['CHILDACTIVITYSET'];
                    $rollup_rules[$item_key][$key]['minimum_count'] = $value['attributes']['MINIMUMCOUNT'];
                    $rollup_rules[$item_key][$key]['minimum_percent'] = $value['attributes']['MINIMUMPERCENT'];
                    $rollup_rules[$item_key][$key]['action'] = $value['attributes']['ACTION'];
                    break;
                case 'IMSSS:ROLLUPCONDITIONS':
                    $rollup_rules[$item_key][$rollup_rule_key]['condition_combination'] = $value['attributes']['CONDITIONCOMBINATION'];
                    break;
                case 'IMSSS:ROLLUPACTION':
                    $rollup_rules[$item_key][$rollup_rule_key]['rule_action'] = $value['attributes']['ACTION'];
                    break;
                case 'IMSSS:ROLLUPCONDITION':
                    $rollup_rule_conditions[$rollup_rule_key][$key]['operator'] = $value['attributes']['OPERATOR'];
                    $rollup_rule_conditions[$rollup_rule_key][$key]['condition'] = $value['attributes']['CONDITION'];
                    break;
                case 'ADLNAV:PRESENTATION':
                    $item_key = $value['parent_index'];
                    break;
                case 'ADLNAV:HIDELMSUI':
                    $hide_lms_ui[$item_key][$value['value']] = 'true';
                    break;
                case 'IMSSS:CONTROLMODE':
                    $control_mode[$item_key][$key]['choice'] = $value['attributes']['CHOICE'];
                    $control_mode[$item_key][$key]['choice_exit'] = $value['attributes']['CHOICEEXIT'];
                    $control_mode[$item_key][$key]['flow'] = $value['attributes']['FLOW'];
                    $control_mode[$item_key][$key]['forward_only'] = $value['attributes']['FORWARDONLY'];
                    $control_mode[$item_key][$key]['use_current_attempt_objective_info'] = $value['attributes']['USECURRENTATTEMPTOBJECTIVEINFO'];
                    $control_mode[$item_key][$key]['use_current_attempt_progress_info'] = $value['attributes']['USECURRENTATTEMPTPROGRESSINFO'];
                    break;
                case 'ADLSEQ:CONSTRAINEDCHOICECONSIDERATIONS':
                    $constrained_choice[$item_key]['prevent_activation'] = $value['attributes']['PREVENTACTIVATION'];
                    $constrained_choice[$item_key]['constrain_choice'] = $value['attributes']['CONSTRAINCHOICE'];
                    break;
                case 'IMSSS:DELIVERYCONTROLS':
                    $delivery_controls[$item_key][$key]['objective_set_by_content'] = $value['attributes']['OBJECTIVESETBYCONTENT'];
                    $delivery_controls[$item_key][$key]['completion_set_by_content'] = $value['attributes']['COMPLETIONSETBYCONTENT'];
                    $delivery_controls[$item_key][$key]['tracked'] = $value['attributes']['TRACKED'];
                    break;
                case 'ADLCP:MAP':
                    $maps[$item_key][$key]['target_ID'] = $value['attributes']['TARGETID'];
                    $maps[$item_key][$key]['read_shared_data'] = $value['attributes']['READSHAREDDATA'];
                    $maps[$item_key][$key]['write_shared_data'] = $value['attributes']['WRITESHAREDDATA'];
                    break;
                default:
                    break;
            }
        }
        //	exit();
        if (G_VERSIONTYPE != 'community') {
            #cpp#ifndef COMMUNITY
            if (G_VERSIONTYPE != 'standard') {
                #cpp#ifndef STANDARD
                if ($scorm2004) {
                    foreach ($references as $key => $value) {
                        $ref = array_search($value['IDENTIFIERREF'], $resources);
                        if ($ref !== false && !is_null($ref)) {
                            /*SCORM 2004: The xml:base attribute provides a relative path offset for the content file(s) contained in the manifest*/
                            $path_offset = $tagArray[$ref]['attributes']['XML:BASE'];
                            $data = file_get_contents($scormPath . "/" . $path_offset . $tagArray[$ref]['attributes']['HREF']);
                            $primitive_hrefs[$ref] = str_replace("\\", "/", $path_offset . $tagArray[$ref]['attributes']['HREF']);
                            $path_part[$ref] = dirname($primitive_hrefs[$ref]);
                            foreach ($tagArray[$ref]['children'] as $value2) {
                                if ($tagArray[$value2]['tag'] == 'DEPENDENCY') {
                                    $idx = array_search($tagArray[$value2]['attributes']['IDENTIFIERREF'], $resources);
                                    foreach ($tagArray[$idx]['children'] as $value3) {
                                        if ($tagArray[$value3]['tag'] == 'FILE') {
                                            $data = preg_replace("#(\\.\\.\\/(\\w+\\/)*)?" . $tagArray[$value3]['attributes']['HREF'] . "#", $currentLesson->getDirectory() . "/" . $scormFolderName . '/' . $path_part[$ref] . "/\$1" . $tagArray[$value3]['attributes']['HREF'], $data);
                                        }
                                    }
                                }
                            }
                            //$total_fields[$key]['data'] = eF_postProcess(str_replace("'","&#039;",$data));
                            //$total_fields$adl_seq_map_info[$item_key][$key]['target_objective_ID'[$key]['data'] = '<iframe height = "100%"  width = "100%" frameborder = "no" name = "scormFrameName" id = "scormFrameID" src = "'.G_RELATIVELESSONSLINK.$lessons_ID."/".$scormFolderName.'/'.$primitive_hrefs[$ref]. $value['PARAMETERS']. '" onload = "eF_js_setCorrectIframeSize()"></iframe><iframe name = "commitFrame" frameborder = "no" id = "commitFrame" width = "1" height = "1" style = "display:none"></iframe>';
                            //
                            //
                            //
                            if ($parameters['embed_type'] == 'iframe') {
                                $total_fields[$key]['data'] = '<iframe ' . $parameters['iframe_parameters'] . ' name = "scormFrameName" id = "scormFrameID" src = "' . rtrim($currentLesson->getDirectoryUrl(), "/") . "/" . $scormFolderName . '/' . $primitive_hrefs[$ref] . $value['PARAMETERS'] . '" onload = "if (window.eF_js_setCorrectIframeSize) {eF_js_setCorrectIframeSize();} else {setIframeSize = true;}"></iframe>';
                            } else {
                                $total_fields[$key]['data'] = '
	                            	<div style = "text-align:center;height:300px">
		                            	<span>##CLICKTOSTARTUNIT##</span><br/>
		                        		<input type = "button" value = "##STARTUNIT##" class = "flatButton" onclick = \'window.open("' . rtrim($currentLesson->getDirectoryUrl(), "/") . "/" . rawurlencode($scormFolderName) . '/' . rawurlencode($primitive_hrefs[$ref]) . $value['PARAMETERS'] . '", "scormFrameName", "' . $parameters['popup_parameters'] . '")\' >
	                        		</div>';
                            }
                            /*
                            	                         $total_fields[$key]['data'] = '
                            	                         <style>
                            	                         iframe.scormCommitFrame{width:100%;height:500px;border:1px solid red;}
                            	                         </style>
                            	                         <iframe name = "scormFrameName" id = "scormFrameID" class = "scormFrame" src = "'.$currentLesson -> getDirectoryUrl()."/".$scormFolderName.'/'.$primitive_hrefs[$ref]. $value['PARAMETERS']. '" onload = "eF_js_setCorrectIframeSize()"></iframe>
                            	                         <iframe name = "commitFrame" id = "commitFrame" class = "scormCommitFrame">Sorry, but your browser needs to support iframes to see this</iframe>';
                            */
                        }
                    }
                    $lastUnit = $currentContent->getLastNode();
                    $lastUnit ? $this_id = $lastUnit['id'] : ($this_id = 0);
                    //$this_id = $tree[sizeof($tree) - 1]['id'];
                    foreach ($total_fields as $key => $value) {
                        if (isset($value['ctg_type'])) {
                            $total_fields[$key]['previous_content_ID'] = $this_id;
                            if (!isset($total_fields[$key]['parent_content_ID'])) {
                                $total_fields[$key]['parent_content_ID'] = 0;
                            }
                            $total_fields[$key]['options'] = serialize(array('hide_navigation' => 1, 'complete_unit_setting' => EfrontUnit::COMPLETION_OPTIONS_HIDECOMPLETEUNITICON));
                            $this_id = eF_insertTableData("content", $total_fields[$key]);
                            //we want to have entry at scorm data even if all values are null
                            $fields_insert[$this_id]['content_ID'] = $this_id;
                            if (!empty($organizations[$key])) {
                                $organization_content_ID = $this_id;
                                $fields_insert1 = array();
                                $fields_insert1['content_ID'] = $this_id;
                                $fields_insert1['lessons_ID'] = $lessons_ID;
                                $fields_insert1['organization_ID'] = $organizations[$key]['id'];
                                $fields_insert1['structure'] = $organizations[$key]['structure'] ? $organizations[$key]['structure'] : 'hierarchical';
                                $fields_insert1['objectives_global_to_system'] = $organizations[$key]['objectives_global_to_system'] ? $organizations[$key]['objectives_global_to_system'] : 'true';
                                $fields_insert1['shared_data_global_to_system'] = $organizations[$key]['shared_data_global_to_system'] ? $organizations[$key]['shared_data_global_to_system'] : 'true';
                                eF_insertTableData("scorm_sequencing_organizations", $fields_insert1);
                            }
                            eF_insertTableData("scorm_sequencing_content_to_organization", array('lessons_ID' => $lessons_ID, 'content_ID' => $this_id, 'organization_content_ID' => $organization_content_ID));
                            $fields_insert1 = array();
                            foreach ($rule_conditions[$key] as $key1 => $value1) {
                                $fields_insert1['content_ID'] = $this_id;
                                $fields_insert1['condition_combination'] = $value1['condition_combination'] ? $value1['condition_combination'] : 'all';
                                $fields_insert1['rule_action'] = $value1['rule_action'];
                                $scorm_sequencing_rules_ID = eF_insertTableData("scorm_sequencing_rules", $fields_insert1);
                                $fields_insert2 = array();
                                foreach ($rule_condition[$key1] as $key2 => $value2) {
                                    $fields_insert2['scorm_sequencing_rules_ID'] = $scorm_sequencing_rules_ID;
                                    $fields_insert2['referenced_objective'] = EfrontContentTreeSCORM::form_id($value2['referenced_objective']);
                                    $fields_insert2['measure_threshold'] = $value2['measure_threshold'];
                                    $fields_insert2['operator'] = $value2['operator'];
                                    $fields_insert2['rule_condition'] = $value2['condition'];
                                    eF_insertTableData("scorm_sequencing_rule", $fields_insert2);
                                }
                            }
                            $fields_insert1 = array();
                            $primary_found = false;
                            //to do
                            foreach ($objective[$key] as $key1 => $value1) {
                                $fields_insert1['content_ID'] = $this_id;
                                $fields_insert1['objective_ID'] = EfrontContentTreeSCORM::form_id($value1['objective_ID']);
                                $fields_insert1['is_primary'] = $value1['is_primary'];
                                $fields_insert1['satisfied_by_measure'] = $value1['satisfied_by_measure'] ? $value1['satisfied_by_measure'] : 'false';
                                $fields_insert1['min_normalized_measure'] = $value1['min_normalized_measure'] ? $value1['min_normalized_measure'] : '1.0';
                                if ($value1['is_primary'] == 1) {
                                    $primary_found = true;
                                }
                                $scorm_sequencing_objectives_ID = eF_insertTableData("scorm_sequencing_objectives", $fields_insert1);
                            }
                            //IMSSS:Each activity must have one, and only one, objective that contributes to rollup.
                            $fields_insert1 = array();
                            if (!$primary_found) {
                                $fields_insert1['content_ID'] = $this_id;
                                $fields_insert1['is_primary'] = '1';
                                $fields_insert1['satisfied_by_measure'] = 'false';
                                $fields_insert1['objective_ID'] = '';
                                $fields_insert1['min_normalized_measure'] = '1';
                                eF_insertTableData("scorm_sequencing_objectives", $fields_insert1);
                            }
                            $shared_objectives = array();
                            $fields_insert1 = array();
                            foreach ($map_info[$key] as $key1 => $value1) {
                                $fields_insert1['content_ID'] = $this_id;
                                $fields_insert1['objective_ID'] = EfrontContentTreeSCORM::form_id($value1['objective_ID']);
                                $fields_insert1['target_objective_ID'] = EfrontContentTreeSCORM::form_id($value1['target_objective_ID']);
                                $fields_insert1['read_satisfied_status'] = $value1['read_satisfied_status'] ? $value1['read_satisfied_status'] : 'true';
                                $fields_insert1['read_normalized_measure'] = $value1['read_normalized_measure'] ? $value1['read_normalized_measure'] : 'true';
                                $fields_insert1['write_satisfied_status'] = $value1['write_satisfied_status'] ? $value1['write_satisfied_status'] : 'false';
                                $fields_insert1['write_normalized_measure'] = $value1['write_normalized_measure'] ? $value1['write_normalized_measure'] : 'false';
                                $shared_objective[] = EfrontContentTreeSCORM::form_id($value1['target_objective_ID']);
                                eF_insertTableData("scorm_sequencing_map_info", $fields_insert1);
                            }
                            $fields_insert1 = array();
                            foreach ($adl_seq_map_info[$key] as $key1 => $value1) {
                                $fields_insert1['content_ID'] = $this_id;
                                $fields_insert1['lessons_ID'] = $_SESSION['s_lessons_ID'];
                                $fields_insert1['objective_ID'] = EfrontContentTreeSCORM::form_id($value1['objective_ID']);
                                $fields_insert1['target_objective_ID'] = EfrontContentTreeSCORM::form_id($value1['target_objective_ID']);
                                $fields_insert1['read_raw_score'] = $value1['read_raw_score'] ? $value1['read_raw_score'] : 'true';
                                $fields_insert1['read_min_score'] = $value1['read_min_score'] ? $value1['read_min_score'] : 'true';
                                $fields_insert1['read_max_score'] = $value1['read_max_score'] ? $value1['read_max_score'] : 'true';
                                $fields_insert1['read_completion_status'] = $value1['read_completion_status'] ? $value1['read_completion_status'] : 'true';
                                $fields_insert1['read_progress_measure'] = $value1['read_progress_measure'] ? $value1['read_progress_measure'] : 'true';
                                $fields_insert1['write_raw_score'] = $value1['write_raw_score'] ? $value1['write_raw_score'] : 'false';
                                $fields_insert1['write_min_score'] = $value1['write_min_score'] ? $value1['write_min_score'] : 'false';
                                $fields_insert1['write_max_score'] = $value1['write_max_score'] ? $value1['write_max_score'] : 'false';
                                $fields_insert1['write_completion_status'] = $value1['write_completion_status'] ? $value1['write_completion_status'] : 'false';
                                $fields_insert1['write_progress_measure'] = $value1['write_progress_measure'] ? $value1['write_progress_measure'] : 'false';
                                $shared_objective[] = EfrontContentTreeSCORM::form_id($value1['target_objective_ID']);
                                eF_insertTableData("scorm_sequencing_adlseq_map_info", $fields_insert1);
                            }
                            $fields_insert1 = array();
                            $default_activity_flag = true;
                            $default_objective_flag = true;
                            foreach ($rollup_rules[$key] as $key1 => $value1) {
                                $fields_insert1['content_ID'] = $this_id;
                                $fields_insert1['child_activity_set'] = $value1['child_activity_set'] ? $value1['child_activity_set'] : 'all';
                                $fields_insert1['minimum_count'] = $value1['minimum_count'] ? $value1['minimum_count'] : '0';
                                $fields_insert1['minimum_percent'] = $value1['minimum_percent'] ? $value1['minimum_percent'] : '0.0000';
                                $fields_insert1['condition_combination'] = $value1['condition_combination'] ? $value1['condition_combination'] : 'any';
                                $fields_insert1['rule_action'] = $value1['rule_action'];
                                $scorm_sequencing_rollup_rules_ID = eF_insertTableData("scorm_sequencing_rollup_rules", $fields_insert1);
                                if (in_array($fields_insert1['rule_action'], array('completed', 'incomplete'))) {
                                    $default_activity_flag = false;
                                }
                                if (in_array($fields_insert1['rule_action'], array('satisfied', 'notSatisfied'))) {
                                    $default_objective_flag = false;
                                }
                                $fields_insert2 = array();
                                foreach ($rollup_rule_conditions[$key1] as $key2 => $value2) {
                                    $fields_insert2['scorm_sequencing_rollup_rules_ID'] = $scorm_sequencing_rollup_rules_ID;
                                    $fields_insert2['operator'] = $value2['operator'];
                                    $fields_insert2['rule_condition'] = $value2['condition'];
                                    eF_insertTableData("scorm_sequencing_rollup_rule", $fields_insert2);
                                }
                            }
                            $default_activity_flag = false;
                            //Default activity rollup rules
                            if ($default_activity_flag) {
                                $rollup_rules_satisfied = array('content_ID' => $this_id, 'child_activity_set' => 'all', 'rule_action' => 'completed', 'minimum_count' => '0', 'minimum_percent' => '0', 'condition_combination' => 'any');
                                ${$rollup_rule_satisfied} = array('scorm_sequencing_rollup_rules_ID' => $rollup_rule_ID, 'rule_condition' => 'completed');
                                //eF_insertTableData("scorm_sequencing_rollup_rule", $rollup_rule_satisfied);
                                $rollup_rules_not_satisfied = array('content_ID' => $this_id, 'child_activity_set' => 'all', 'rule_action' => 'incomplete', 'minimum_count' => '0', 'minimum_percent' => '0', 'condition_combination' => 'any');
                                //$rollup_rule_ID = eF_insertTableData("scorm_sequencing_rollup_rules", $rollup_rules_not_satisfied);
                                $rollup_rule_not_satisfied = array('scorm_sequencing_rollup_rules_ID' => $rollup_rule_ID, 'rule_condition' => 'activityProgressKnown');
                                //eF_insertTableData("scorm_sequencing_rollup_rule", $rollup_rule_not_satisfied);
                            }
                            $default_objective_flag = false;
                            //Default objective rollup rules
                            if ($default_objective_flag) {
                                $rollup_rules_satisfied = array('content_ID' => $this_id, 'child_activity_set' => 'all', 'rule_action' => 'satisfied', 'minimum_count' => '0', 'minimum_percent' => '0', 'condition_combination' => 'any');
                                //$rollup_rule_ID = eF_insertTableData("scorm_sequencing_rollup_rules", $rollup_rules_satisfied);
                                $rollup_rule_satisfied = array('scorm_sequencing_rollup_rules_ID' => $rollup_rule_ID, 'rule_condition' => 'satisfied');
                                //eF_insertTableData("scorm_sequencing_rollup_rule", $rollup_rule_satisfied);
                                $rollup_rules_not_satisfied = array('content_ID' => $this_id, 'child_activity_set' => 'all', 'rule_action' => 'notSatisfied', 'minimum_count' => '0', 'minimum_percent' => '0', 'condition_combination' => 'any');
                                //$rollup_rule_ID = eF_insertTableData("scorm_sequencing_rollup_rules", $rollup_rules_not_satisfied);
                                $rollup_rule_not_satisfied = array('scorm_sequencing_rollup_rules_ID' => $rollup_rule_ID, 'rule_condition' => 'objectiveStatusKnown');
                                //eF_insertTableData("scorm_sequencing_rollup_rule", $rollup_rule_not_satisfied);
                            }
                            //pr($constrained_choice[$key]);
                            $fields_insert1 = array();
                            if ($constrained_choice[$key]) {
                                $fields_insert1['content_ID'] = $this_id;
                                $fields_insert1['prevent_activation'] = $constrained_choice[$key]['prevent_activation'] ? $constrained_choice[$key]['prevent_activation'] : 'false';
                                $fields_insert1['constrain_choice'] = $constrained_choice[$key]['constrain_choice'] ? $constrained_choice[$key]['constrain_choice'] : 'false';
                                eF_insertTableData("scorm_sequencing_constrained_choice", $fields_insert1);
                            }
                            if (empty($control_mode[$key])) {
                                $control_mode[$key][0]['choice'] = 'true';
                                $control_mode[$key][0]['choice_exit'] = 'true';
                                $control_mode[$key][0]['flow'] = 'false';
                                $control_mode[$key][0]['forward_only'] = 'false';
                                $control_mode[$key][0]['use_current_attempt_objective_info'] = 'true';
                                $control_mode[$key][0]['use_current_attempt_progress_info'] = 'true';
                            }
                            //echo $key;
                            //pr($control_mode);
                            $fields_insert1 = array();
                            foreach ($control_mode[$key] as $key1 => $value1) {
                                $fields_insert1['content_ID'] = $this_id;
                                $fields_insert1['choice'] = $value1['choice'] ? $value1['choice'] : 'true';
                                $fields_insert1['choice_exit'] = $value1['choice_exit'] ? $value1['choice_exit'] : 'true';
                                $fields_insert1['flow'] = $value1['flow'] ? $value1['flow'] : 'false';
                                $fields_insert1['forward_only'] = $value1['forward_only'] ? $value1['forward_only'] : 'false';
                                $fields_insert1['use_current_attempt_objective_info'] = $value1['use_current_attempt_objective_info'] ? $value1['use_current_attempt_objective_info'] : 'true';
                                $fields_insert1['use_current_attempt_progress_info'] = $value1['use_current_attempt_progress_info'] ? $value1['use_current_attempt_progress_info'] : 'true';
                                eF_insertTableData("scorm_sequencing_control_mode", $fields_insert1);
                            }
                            if (empty($delivery_controls[$key])) {
                                $delivery_controls[$key][0]['objective_set_by_content'] = 'false';
                                $delivery_controls[$key][0]['completion_set_by_content'] = 'false';
                                $delivery_controls[$key][0]['tracked'] = 'true';
                            }
                            $fields_insert1 = array();
                            foreach ($delivery_controls[$key] as $key1 => $value1) {
                                $fields_insert1['content_ID'] = $this_id;
                                $fields_insert1['objective_set_by_content'] = $value1['objective_set_by_content'] ? $value1['objective_set_by_content'] : 'false';
                                $fields_insert1['completion_set_by_content'] = $value1['completion_set_by_content'] ? $value1['completion_set_by_content'] : 'false';
                                $fields_insert1['tracked'] = $value1['tracked'] ? $value1['tracked'] : 'true';
                                eF_insertTableData("scorm_sequencing_delivery_controls", $fields_insert1);
                            }
                            $fields_insert1 = array();
                            foreach ($maps[$key] as $key1 => $value1) {
                                $fields_insert1['content_ID'] = $this_id;
                                $fields_insert1['target_ID'] = $value1['target_ID'];
                                $fields_insert1['read_shared_data'] = $value1['read_shared_data'] ? $value1['read_shared_data'] : 'true';
                                $fields_insert1['write_shared_data'] = $value1['write_shared_data'] ? $value1['write_shared_data'] : 'true';
                                eF_insertTableData("scorm_sequencing_maps", $fields_insert1);
                            }
                            $fields_insert1 = array();
                            foreach ($limit_conditions[$key] as $key1 => $value1) {
                                $fields_insert1['content_ID'] = $this_id;
                                $fields_insert1['attempt_limit'] = $value1['attempt_limit'];
                                $fields_insert1['attempt_absolute_duration_limit'] = $value1['attempt_absolute_duration_limit'];
                                eF_insertTableData("scorm_sequencing_limit_conditions", $fields_insert1);
                            }
                            if (empty($completion_threshold[$key])) {
                                $completion_threshold[$key][0]['completed_by_measure'] = 'false';
                                $completion_threshold[$key][0]['min_progress_measure'] = '1.0';
                                $completion_threshold[$key][0]['progress_weight'] = '1.0';
                            }
                            $fields_insert1 = array();
                            foreach ($completion_threshold[$key] as $key1 => $value1) {
                                $fields_insert1['content_ID'] = $this_id;
                                $fields_insert1['completed_by_measure'] = $value1['completed_by_measure'] ? $value1['completed_by_measure'] : 'false';
                                $fields_insert1['min_progress_measure'] = $value1['min_progress_measure'] ? $value1['min_progress_measure'] : '1.0';
                                $fields_insert1['progress_weight'] = $value1['progress_weight'] ? $value1['progress_weight'] : '1.0';
                                eF_insertTableData("scorm_sequencing_completion_threshold", $fields_insert1);
                            }
                            if (empty($rollup_considerations[$key])) {
                                $rollup_considerations[$key][0]['required_for_satisfied'] = 'always';
                                $rollup_considerations[$key][0]['required_for_not_satisfied'] = 'always';
                                $rollup_considerations[$key][0]['required_for_completed'] = 'always';
                                $rollup_considerations[$key][0]['required_for_incomplete'] = 'always';
                                $rollup_considerations[$key][0]['measure_satisfaction_if_active'] = 'true';
                            }
                            $fields_insert1 = array();
                            foreach ($rollup_considerations[$key] as $key1 => $value1) {
                                $fields_insert1['content_ID'] = $this_id;
                                $fields_insert1['required_for_satisfied'] = $value1['required_for_satisfied'] ? $value1['required_for_satisfied'] : 'always';
                                $fields_insert1['required_for_not_satisfied'] = $value1['required_for_not_satisfied'] ? $value1['required_for_not_satisfied'] : 'always';
                                $fields_insert1['required_for_completed'] = $value1['required_for_completed'] ? $value1['required_for_completed'] : 'always';
                                $fields_insert1['required_for_incomplete'] = $value1['required_for_incomplete'] ? $value1['required_for_incomplete'] : 'always';
                                $fields_insert1['measure_satisfaction_if_active'] = $value1['measure_satisfaction_if_active'] ? $value1['measure_satisfaction_if_active'] : 'true';
                                eF_insertTableData("scorm_sequencing_rollup_considerations", $fields_insert1);
                            }
                            if (empty($rollup_controls[$key])) {
                                $rollup_controls[$key][0]['rollup_objective_satisfied'] = 'true';
                                $rollup_controls[$key][0]['rollup_objective_measure_weight'] = '1.0';
                                $rollup_controls[$key][0]['rollup_progress_completion'] = 'true';
                            }
                            $fields_insert1 = array();
                            foreach ($rollup_controls[$key] as $key1 => $value1) {
                                $fields_insert1['content_ID'] = $this_id;
                                $fields_insert1['rollup_objective_satisfied'] = $value1['rollup_objective_satisfied'] ? $value1['rollup_objective_satisfied'] : 'true';
                                $fields_insert1['rollup_objective_measure_weight'] = $value1['rollup_objective_measure_weight'] ? $value1['rollup_objective_measure_weight'] : '1.0';
                                $fields_insert1['rollup_progress_completion'] = $value1['rollup_progress_completion'] ? $value1['rollup_progress_completion'] : 'true';
                                eF_insertTableData("scorm_sequencing_rollup_controls", $fields_insert1);
                            }
                            $fields_insert1 = array();
                            foreach ($control_mode[$tagArray[$key]['parent_index']] as $key1 => $value1) {
                                $hide_lms_ui[$key]['choice'] = $value1['choice'];
                            }
                            $fields_insert1[$key]['content_ID'] = $this_id;
                            $fields_insert1[$key]['options'] = serialize($hide_lms_ui[$key]);
                            eF_insertTableData("scorm_sequencing_hide_lms_ui", $fields_insert1[$key]);
                            $tagArray[$key]['this_id'] = $this_id;
                            foreach ($tagArray[$key]['children'] as $key2 => $value2) {
                                if (isset($total_fields[$value2])) {
                                    $total_fields[$value2]['parent_content_ID'] = $this_id;
                                }
                            }
                        } else {
                            unset($total_fields[$key]);
                        }
                    }
                    /*
                    	                $fields_insert1 = array();
                    	                foreach (array_unique($shared_objective) as $key1=>$value1) {
                    	                    //$fields_insert1['lessons_ID'] = $_SESSION['s_lessons_ID'];
                    	                    $fields_insert1['content_ID'] = 0;
                    	                    $fields_insert1['is_primary'] = '1';
                    	                    $fields_insert1['satisfied_by_measure'] = 'false';
                    	                    $fields_insert1['objective_ID'] = EfrontContentTreeSCORM :: form_id($value1);
                    	                    $fields_insert1['min_normalized_measure'] = '1';
                    
                    
                    	                    eF_insertTableData("scorm_sequencing_objectives", $fields_insert1);
                    					}*/
                    //$directory = new EfrontDirectory(G_SCORMPATH);
                    //$directory -> copy(EfrontDirectory :: normalize($currentLesson -> getDirectory()).'/'.$scormFolderName, true);
                    //foreach ($files as $key => $value) {
                    //$newhref = $tagArray[$tagArray[$key]['parent_index']]['attributes']['XML:BASE'];
                    //copy(G_SCORMPATH."/".rtrim($newhref,"/")."/".rtrim($value,"/"), rtrim($currentLesson -> getDirectory(), "/")."/$this_id/".rtrim($newhref,"/")."/".rtrim($value,"/"));
                    //$this_id is put here so we can be sure that the files are put in a unique folder
                    //}
                    foreach ($timelimitaction as $key => $value) {
                        $content_ID = $tagArray[$tagArray[$key]['parent_index']]['this_id'];
                        $fields_insert[$content_ID]['content_ID'] = $content_ID;
                        $fields_insert[$content_ID]['timelimitaction'] = $value;
                    }
                    foreach ($maxtimeallowed as $key => $value) {
                        $content_ID = $tagArray[$tagArray[$key]['parent_index']]['this_id'];
                        $fields_insert[$content_ID]['content_ID'] = $content_ID;
                        $fields_insert[$content_ID]['maxtimeallowed'] = $value;
                    }
                    foreach ($masteryscore as $key => $value) {
                        $content_ID = $tagArray[$tagArray[$key]['parent_index']]['this_id'];
                        $fields_insert[$content_ID]['content_ID'] = $content_ID;
                        $fields_insert[$content_ID]['masteryscore'] = $value;
                    }
                    foreach ($datafromlms as $key => $value) {
                        $content_ID = $tagArray[$tagArray[$key]['parent_index']]['this_id'];
                        $fields_insert[$content_ID]['content_ID'] = $content_ID;
                        $fields_insert[$content_ID]['datafromlms'] = $value;
                    }
                    foreach ($fields_insert as $key => $value) {
                        eF_insertTableData("scorm_data_2004", $value);
                        if (isset($value['masteryscore']) && $value['masteryscore']) {
                            eF_updateTableData("content", array("ctg_type" => "scorm_test"), "id=" . $value['content_ID']);
                        }
                    }
                    foreach ($prerequisites as $key => $value) {
                        foreach ($tagArray as $key2 => $value2) {
                            if (isset($value2['attributes']['IDENTIFIER']) && $value2['attributes']['IDENTIFIER'] == $value) {
                                unset($fields_insert);
                                $fields_insert['users_LOGIN'] = "******";
                                $fields_insert['content_ID'] = $tagArray[$tagArray[$key]['parent_index']]['this_id'];
                                $fields_insert['rule_type'] = "hasnot_seen";
                                $fields_insert['rule_content_ID'] = $value2['this_id'];
                                $fields_insert['rule_option'] = 0;
                                eF_insertTableData("rules", $fields_insert);
                            }
                        }
                    }
                }
            }
            #cpp#endif
        }
        #cpp#endif
        if (!$scorm2004) {
            foreach ($references as $key => $value) {
                //$ref = array_search($value, $resources);
                $ref = array_search($value['IDENTIFIERREF'], $resources);
                if ($ref !== false && !is_null($ref)) {
                    $data = file_get_contents($scormPath . "/" . $tagArray[$ref]['attributes']['HREF']);
                    $primitive_hrefs[$ref] = str_replace("\\", "/", $tagArray[$ref]['attributes']['HREF']);
                    $path_part[$ref] = dirname($primitive_hrefs[$ref]);
                    foreach ($tagArray[$ref]['children'] as $value2) {
                        if ($tagArray[$value2]['tag'] == 'DEPENDENCY') {
                            $idx = array_search($tagArray[$value2]['attributes']['IDENTIFIERREF'], $resources);
                            foreach ($tagArray[$idx]['children'] as $value3) {
                                if ($tagArray[$value3]['tag'] == 'FILE') {
                                    $data = preg_replace("#(\\.\\.\\/(\\w+\\/)*)?" . $tagArray[$value3]['attributes']['HREF'] . "#", $currentLesson->getDirectory() . "/" . $scormFolderName . '/' . $path_part[$ref] . "/\$1" . $tagArray[$value3]['attributes']['HREF'], $data);
                                }
                            }
                        }
                    }
                    //$total_fields[$key]['data'] = eF_postProcess(str_replace("'","&#039;",$data));
                    if ($parameters['embed_type'] == 'iframe') {
                        //$total_fields[$key]['data'] = '<iframe height = "100%"  width = "100%" frameborder = "no" name = "scormFrameName" id = "scormFrameID" src = "'.$currentLesson -> getDirectoryUrl()."/".$scormFolderName.'/'.$primitive_hrefs[$ref].'" onload = "if (window.eF_js_setCorrectIframeSize) {eF_js_setCorrectIframeSize();} else {setIframeSize = true;}"></iframe>';
                        $total_fields[$key]['data'] = '<iframe ' . $parameters['iframe_parameters'] . ' name = "scormFrameName" id = "scormFrameID" src = "' . rtrim($currentLesson->getDirectoryUrl(), "/") . "/" . $scormFolderName . '/' . $primitive_hrefs[$ref] . $value['PARAMETERS'] . '" onload = "if (window.eF_js_setCorrectIframeSize) {eF_js_setCorrectIframeSize();} else {setIframeSize = true;}"></iframe>';
                    } else {
                        $total_fields[$key]['data'] = '
                            <div style = "text-align:center;height:300px">
                            	<span>##CLICKTOSTARTUNIT##</span><br/>
		                    	<input type = "button" value = "##STARTUNIT##" class = "flatButton" onclick = \'window.open("' . rtrim($currentLesson->getDirectoryUrl(), "/") . "/" . rawurlencode($scormFolderName) . '/' . rawurlencode($primitive_hrefs[$ref]) . $value['PARAMETERS'] . '", "scormFrameName", "' . $parameters['popup_parameters'] . '")\' >
                        	</div>';
                    }
                }
            }
            $lastUnit = $currentContent->getLastNode();
            $lastUnit ? $this_id = $lastUnit['id'] : ($this_id = 0);
            //$this_id = $tree[sizeof($tree) - 1]['id'];
            foreach ($total_fields as $key => $value) {
                if (isset($value['ctg_type'])) {
                    $total_fields[$key]['previous_content_ID'] = $this_id;
                    if (!isset($total_fields[$key]['parent_content_ID'])) {
                        $total_fields[$key]['parent_content_ID'] = 0;
                    }
                    $total_fields[$key]['options'] = serialize(array('complete_unit_setting' => EfrontUnit::COMPLETION_OPTIONS_HIDECOMPLETEUNITICON));
                    $this_id = eF_insertTableData("content", $total_fields[$key]);
                    $tagArray[$key]['this_id'] = $this_id;
                    foreach ($tagArray[$key]['children'] as $key2 => $value2) {
                        if (isset($total_fields[$value2])) {
                            $total_fields[$value2]['parent_content_ID'] = $this_id;
                        }
                    }
                } else {
                    unset($total_fields[$key]);
                }
            }
            //$directory = new EfrontDirectory(G_SCORMPATH);
            //$directory -> copy(EfrontDirectory :: normalize($currentLesson -> getDirectory()).'/'.$scormFolderName, true);
            //foreach ($files as $key => $value) {
            //$newhref = $tagArray[$tagArray[$key]['parent_index']]['attributes']['XML:BASE'];
            //copy(G_SCORMPATH."/".rtrim($newhref,"/")."/".rtrim($value,"/"), rtrim($currentLesson -> getDirectory(), "/")."/$this_id/".rtrim($newhref,"/")."/".rtrim($value,"/"));    //$this_id is put here so we can be sure that the files are put in a unique folder
            //}
            foreach ($timelimitaction as $key => $value) {
                $content_ID = $tagArray[$tagArray[$key]['parent_index']]['this_id'];
                $fields_insert[$content_ID]['content_ID'] = $content_ID;
                $fields_insert[$content_ID]['timelimitaction'] = $value;
            }
            foreach ($maxtimeallowed as $key => $value) {
                $content_ID = $tagArray[$tagArray[$key]['parent_index']]['this_id'];
                $fields_insert[$content_ID]['content_ID'] = $content_ID;
                $fields_insert[$content_ID]['maxtimeallowed'] = $value;
            }
            foreach ($masteryscore as $key => $value) {
                $content_ID = $tagArray[$tagArray[$key]['parent_index']]['this_id'];
                $fields_insert[$content_ID]['content_ID'] = $content_ID;
                $fields_insert[$content_ID]['masteryscore'] = $value;
            }
            foreach ($datafromlms as $key => $value) {
                $content_ID = $tagArray[$tagArray[$key]['parent_index']]['this_id'];
                $fields_insert[$content_ID]['content_ID'] = $content_ID;
                $fields_insert[$content_ID]['datafromlms'] = $value;
            }
            foreach ($fields_insert as $key => $value) {
                eF_insertTableData("scorm_data", $value);
                if (isset($value['masteryscore']) && $value['masteryscore']) {
                    eF_updateTableData("content", array("ctg_type" => "scorm_test"), "id=" . $value['content_ID']);
                }
            }
            foreach ($prerequisites as $key => $parts) {
                foreach (explode("&", $parts) as $value) {
                    foreach ($tagArray as $key2 => $value2) {
                        if (isset($value2['attributes']['IDENTIFIERREF']) && $value2['attributes']['IDENTIFIERREF'] == $value) {
                            //pr($value2);
                            unset($fields_insert);
                            $fields_insert['users_LOGIN'] = "******";
                            $fields_insert['content_ID'] = $tagArray[$tagArray[$key]['parent_index']]['this_id'];
                            $fields_insert['rule_type'] = "hasnot_seen";
                            $fields_insert['rule_content_ID'] = $value2['this_id'];
                            $fields_insert['rule_option'] = 0;
                            eF_insertTableData("rules", $fields_insert);
                        }
                    }
                }
            }
        }
        //exit;
        EfrontCache::getInstance()->deleteCache("content_tree:{$lesson->lesson['id']}");
    }
示例#10
0
    }
    #cpp#endif
}
#cpp#endif
$userMainForm->setDefaults($GLOBALS['configuration']);
if (isset($currentUser->coreAccess['configuration']) && $currentUser->coreAccess['configuration'] != 'change') {
    $userMainForm->freeze();
} else {
    $userMainForm->addElement("submit", "submit", _SAVE, 'class = "flatButton"');
    if ($userMainForm->isSubmitted() && $userMainForm->validate()) {
        $values = $userMainForm->exportValues();
        if ($values['reset_license_note'] || $values['reset_license_note_always']) {
            eF_updateTableData("users", array("viewed_license" => 0), "viewed_license = 1");
        }
        if ($values['username_format']) {
            EfrontCache::getInstance()->deleteCache('usernames');
        }
        if ($values['time_reports'] != $GLOBALS['configuration']['time_reports']) {
            EfrontSystem::switchLessonReportingMode($values['time_reports']);
        }
        unset($values['reset_license_note']);
        //Unset it, since we don't need to store this value to the database
        unset($values['submit']);
        foreach ($values as $key => $value) {
            EfrontConfiguration::setValue($key, $value);
        }
        eF_redirect(basename($_SERVER['PHP_SELF']) . "?ctg=system_config&op=user&tab=main&message=" . urlencode(_SUCCESFULLYUPDATECONFIGURATION) . "&message_type=success");
    }
}
$smarty->assign("T_USER_MAIN_FORM", $userMainForm->toArray());
$userMultipleLoginsForm = new HTML_QuickForm("user_multiple_logins_form", "post", basename($_SERVER['PHP_SELF']) . "?ctg=system_config&op=user&tab=multiple_logins", "", null, true);
示例#11
0
 /**
  * Persist question changes
  *
  * This function is used to store changed question attributes to
  * the database.
  * <br>Example:
  * <code>
  * $question -> question['text'] = 'new title';             //Change question title
  * $question -> persist();                                  //Persist changed value
  * </code>
  *
  * @since 3.5.0
  * @access public
  */
 public function persist()
 {
     $fields = array("text" => $this->question['text'], "type" => $this->question['type'], "content_ID" => $this->question['content_ID'], "lessons_ID" => $this->question['lessons_ID'], "difficulty" => $this->question['difficulty'], "options" => $this->question['options'], "answer" => $this->question['answer'], "estimate" => $this->question['estimate'], "linked_to" => $this->question['linked_to'], "explanation" => $this->question['explanation'], "answers_explanation" => $this->question['answers_explanation'], "settings" => $this->question['settings']);
     foreach ($this->getTests() as $id => $test) {
         EfrontCache::getInstance()->deleteCache('test:' . $id);
     }
     eF_updateTableData("questions", $fields, "id=" . $this->question['id']);
     $result = eF_getTableData("questions", "id", "linked_to={$this->question['id']}");
     unset($fields['lessons_ID']);
     unset($fields['content_ID']);
     foreach ($result as $value) {
         eF_updateTableData("questions", $fields, "id={$value['id']}");
     }
     return true;
 }
示例#12
0
                }
                //Don't halt if no file was uploaded (errcode = 4). Otherwise, throw the exception
            }
            if (empty($logoFile)) {
                $logoFile = new EfrontFile(EfrontSystem::setLogoFile($currentTheme));
            }
            // Normalize avatar picture to the dimensions set in the System Configuration menu. NOTE: the picture will be modified to match existing settings. Future higher settings will be disregarded, while lower ones might affect the quality of the displayed image
            if ($values["normalize_dimensions"] == 1) {
                eF_normalizeImage(G_LOGOPATH . $logoFile['name'], $logoFile['extension'], $values["logo_max_width"], $values["logo_max_height"]);
            } else {
                list($width, $height) = getimagesize(G_LOGOPATH . $logoFile['name']);
                eF_createImage(G_LOGOPATH . $logoFile['name'], $logoFile['extension'], $width, $height, $values["logo_max_width"], $values["logo_max_height"]);
            }
            EfrontConfiguration::setValue('logo_timestamp', time());
            // to avoid browser caching when changing logo dimensions
            EfrontCache::getInstance()->deleteCache('logo');
            eF_redirect(basename($_SERVER['PHP_SELF']) . "?ctg=system_config&op=appearance&tab=logo&message=" . urlencode(_SUCCESFULLYUPDATECONFIGURATION) . "&message_type=success");
        } catch (Exception $e) {
            handleNormalFlowExceptions($e);
        }
    }
}
$smarty->assign("T_APPEARANCE_LOGO_FORM", $appearanceLogoForm->toArray());
$appearanceFaviconForm = new Html_QuickForm("appearance_favicon_form", "post", basename($_SERVER['PHP_SELF']) . "?ctg=system_config&op=appearance&tab=favicon", "", null, true);
$appearanceFaviconForm->registerRule('checkParameter', 'callback', 'eF_checkParameter');
$appearanceFaviconForm->addElement('file', 'favicon', _FILENAME);
$appearanceFaviconForm->addElement("static", "", _EACHFILESIZEMUSTBESMALLERTHAN . ' <b>' . FileSystemTree::getUploadMaxSize() . '</b> ' . _KB);
$appearanceFaviconForm->addElement("advcheckbox", "default_favicon", _USEDEFAULTFAVICON, null, 'class = "inputCheckBox"  id = "set_default_favicon" onclick = "$(\'favicon_settings\').select(\'input\').each(function(s) {if (s.type != \'submit\' && s.id != \'set_default_favicon\') s.disabled ? s.disabled = \'\' : s.disabled = \'disabled\' })"', array(0, 1));
$appearanceFaviconForm->setMaxFileSize(FileSystemTree::getUploadMaxSize() * 1024);
if (isset($currentUser->coreAccess['configuration']) && $currentUser->coreAccess['configuration'] != 'change') {
    $appearanceFaviconForm->freeze();
示例#13
0
                 } else {
                     if ($values['custom']) {
                         $uploadedFile->rename(dirname($uploadedFile['path']) . '/custom-' . $values['english_name'] . '.php.inc', true);
                     } else {
                         $uploadedFile->rename(dirname($uploadedFile['path']) . '/lang-' . $values['english_name'] . '.php.inc', true);
                     }
                 }
             } else {
                 $file = new EfrontFile(G_ROOTPATH . 'libraries/language/lang-english.php.inc');
                 $file->copy(G_ROOTPATH . 'libraries/language/lang-' . $values['english_name'] . '.php.inc');
             }
             $fields = array("name" => $values['english_name'], "translation" => $values['translation'], "active" => 1, "rtl" => $values['rtl']);
             if (!$values['custom']) {
                 eF_insertTableData("languages", $fields);
             }
             EfrontCache::getInstance()->deleteCache('languages');
             //$RetValues = file(G_SERVERNAME."/editor/tiny_mce/langs/language.php?langname=".$values['english_name']);
             eF_redirect("" . basename($_SERVER['PHP_SELF']) . "?ctg=languages&message=" . urlencode(_SUCCESSFULLYADDEDLANGUAGE) . "&message_type=success");
         }
     } catch (Exception $e) {
         $smarty->assign("T_EXCEPTION_TRACE", $e->getTraceAsString());
         $message = $e->getMessage() . ' (' . $e->getCode() . ') &nbsp;<a href = "javascript:void(0)" onclick = "eF_js_showDivPopup(event, \'' . _ERRORDETAILS . '\', 2, \'error_details\')">' . _MOREINFO . '</a>';
         $message_type = 'failure';
     }
 }
 $renderer = new HTML_QuickForm_Renderer_ArraySmarty($smarty);
 $renderer->setRequiredTemplate('{$html}{if $required}
                     &nbsp;<span class = "formRequired">*</span>
                 {/if}');
 $createForm->setJsWarnings(_BEFOREJAVASCRIPTERROR, _AFTERJAVASCRIPTERROR);
 //Set javascript error messages
示例#14
0
/**
* Function to return an array with objects regarding
* ALL module classes installed in the system
* and not only the ones for this user type
* Used for checking for events to be executed
*/
function eF_loadAllModules($onlyActive = true, $disregardUser = false)
{
    if (!$disregardUser && empty($_SESSION['s_login'])) {
        return array();
    }
    $modules = EfrontCache::getInstance()->getCache('modules');
    if (!$modules) {
        $modulesDB = eF_getTableData("modules", "*", "active=1");
        $modules = array();
        foreach ($modulesDB as $module) {
            $folder = $module['position'];
            $className = $module['className'];
            if (!(!empty($_SESSION['s_login']) && $_SESSION['s_type'] == "administrator" && $_GET['ctg'] == "control_panel" && $_GET['op'] == "modules" && $_GET['upgrade'] == $className)) {
                if (is_file(G_MODULESPATH . $folder . "/" . $className . ".class.php")) {
                    if (class_exists($className)) {
                        $modules[$className] = $folder;
                    }
                }
            }
        }
        EfrontCache::getInstance()->setCache('modules', $modules);
    }
    foreach ($modules as $className => $folder) {
        require_once G_MODULESPATH . $folder . "/" . $className . ".class.php";
        $modules[$className] = new $className("", $folder);
    }
    return $modules;
}
示例#15
0
 public function unConfirm($login)
 {
     $login = $this->convertArgumentToUserLogin($login);
     eF_updateTableData("users_to_lessons", array("from_timestamp" => 0), "users_LOGIN='******' and lessons_ID=" . $this->lesson['id']);
     $cacheKey = "user_lesson_status:lesson:" . $this->lesson['id'] . "user:" . $login;
     EfrontCache::getInstance()->deleteCache($cacheKey);
 }
                            //in case changing only popup parameters field
                            preg_match("/\"scormFrameName\".*\"\\)'/U", $currentUnit['data'], $matches);
                            $currentUnit['data'] = preg_replace("/\"scormFrameName\".*\"\\)'/U", '"scormFrameName", "' . $values['popup_parameters'] . '")\'', $currentUnit['data']);
                        }
                        $currentUnit['data'] = preg_replace("/eF_js_setCorrectIframeSize\\(.*\\)/", "eF_js_setCorrectIframeSize(" . $values['scorm_size'] . ")", $currentUnit['data']);
                    }
                    $values['ctg_type'] ? $currentUnit['ctg_type'] = $values['ctg_type'] : null;
                    $values['name'] ? $currentUnit['name'] = $values['name'] : null;
                    $currentUnit['options'] = $options;
                    $currentUnit->persist();
                    $currentUnit->setSearchKeywords();
                } else {
                    $fields = array('name' => $values['name'], 'data' => applyEditorOffset($values['data']), 'parent_content_ID' => $values['parent_content_ID'], 'lessons_ID' => $_SESSION['s_lessons_ID'], 'ctg_type' => $values['ctg_type'], 'active' => 1, 'options' => $options);
                    $currentUnit = $currentContent->insertNode($fields);
                }
                EfrontCache::getInstance()->deleteCache("content_tree:{$_SESSION['s_lessons_ID']}");
                $message = _OPERATIONCOMPLETEDSUCCESSFULLY;
                $message_type = 'success';
                eF_redirect(basename($_SERVER['PHP_SELF']) . '?ctg=content&view_unit=' . $currentUnit['id'] . '&message=' . urlencode($message) . '&message_type=success');
            } catch (Exception $e) {
                handleNormalFlowExceptions($e);
            }
        }
        $form->setJsWarnings(_BEFOREJAVASCRIPTERROR, _AFTERJAVASCRIPTERROR);
        $form->setRequiredNote(_REQUIREDNOTE);
        $renderer = new HTML_QuickForm_Renderer_ArraySmarty($smarty);
        $renderer->setRequiredTemplate('{$html}{if $required}
		            &nbsp;<span class = "formRequired">*</span>
		        {/if}');
        $renderer->setErrorTemplate('{$html}{if $error}
		            <span class = "formError">{$error}</span>
 /**
  * Import lesson
  *
  * This function is used to import a lesson exported to a file
  * The first step is to optionally initialize the lesson, using initialize().
  * It then uncompresses the given file and proceeds to importing
  * <br/>Example:
  * <code>
  * try {
  *     $lesson = new EfrontLesson(32);                                             //32 is the lesson id
  *     $file = new EfrontFile($lesson -> getDirectory().'data.tar.gz');            //The file resides inside the lesson directory and is called 'data.tar.gz'
  *     $lesson -> import(array('content'), $file);
  * } catch (Exception $e) {
  *     echo $e -> getMessage();
  * }
  * </code><br/>
  *
  * @param EfrontFile $file The compressed lesson file object
  * @param array $deleteEntities The lesson aspects to initialize
  * @param boolean $lessonProperties Whether to import lesson properties as well
  * @param boolean $keepName Whether to keep the current (false) or the original name (true)
  * @return boolean True if the importing was successful
  * @since 3.5.0
  * @access public
  * @see EfrontLesson :: initialize()
  */
 public function import($file, $deleteEntities = false, $lessonProperties = false, $keepName = false, $exclude_search = false)
 {
     if ($deleteEntities) {
         $this->initialize($deleteEntities);
         //Initialize the lesson aspects that the user specified
     }
     if (!$file instanceof EfrontFile) {
         $file = new EfrontFile($file);
     }
     $fileList = $file->uncompress();
     $file->delete();
     $fileList = array_unique(array_reverse($fileList, true));
     $dataFile = new EfrontFile($file['directory'] . '/data.dat');
     $filedata = file_get_contents($dataFile['path']);
     $dataFile->delete();
     $data = unserialize($filedata);
     $data['content'] = self::eF_import_fixTree($data['content'], $last_current_node);
     for ($i = 0; $i < sizeof($data['files']); $i++) {
         if (isset($data['files'][$i]['file'])) {
             $newName = str_replace(G_ROOTPATH, '', dirname($data['files'][$i]['file']) . '/' . EfrontFile::encode(eFront_basename($data['files'][$i]['file'])));
             $newName = preg_replace("#(.*)www/content/lessons/#", "www/content/lessons/", $newName);
             $newName = preg_replace("#www/content/lessons/\\d+/(.*)#", "www/content/lessons/" . ($this->lesson['share_folder'] ? $this->lesson['share_folder'] : $this->lesson['id']) . "/\$1", $newName);
             if ($data['files'][$i]['original_name'] != eFront_basename($data['files'][$i]['file'])) {
                 if (is_file(G_ROOTPATH . $newName)) {
                     $replaceString['/\\/?(view_file.php\\?file=)' . $data['files'][$i]['id'] . '([^0-9])/'] = '${1}' . array_search(G_ROOTPATH . $newName, $fileList) . '${2}';
                     //Replace old ids with new ids
                     //$mp[$data['files'][$i]['id']] = array_search(G_ROOTPATH.$newName, $fileList);
                     $file = new EfrontFile(G_ROOTPATH . $newName);
                     $file->rename(G_ROOTPATH . dirname($newName) . '/' . EfrontFile::encode(rtrim($data['files'][$i]['original_name'], "/")));
                 }
             }
         } else {
             $newName = preg_replace("#www/content/lessons/\\d+/(.*)#", "www/content/lessons/" . ($this->lesson['share_folder'] ? $this->lesson['share_folder'] : $this->lesson['id']) . "/\$1", $data['files'][$i]['path']);
             if (is_file(G_ROOTPATH . $newName)) {
                 $replaceString['/\\/?(view_file.php\\?file=)' . $data['files'][$i]['id'] . '([^0-9])/'] = '${1}' . array_search(G_ROOTPATH . $newName, $fileList) . '${2}';
                 //Replace old ids with new ids
             }
         }
     }
     for ($i = 0; $i < sizeof($data['files']); $i++) {
         if (isset($data['files'][$i]['file'])) {
             $newName = str_replace(G_ROOTPATH, '', dirname($data['files'][$i]['file']) . '/' . EfrontFile::encode(eFront_basename($data['files'][$i]['file'])));
             $newName = preg_replace("#(.*)www/content/lessons/#", "www/content/lessons/", $newName);
             $newName = preg_replace("#www/content/lessons/\\d+/(.*)#", "www/content/lessons/" . ($this->lesson['share_folder'] ? $this->lesson['share_folder'] : $this->lesson['id']) . "/\$1", $newName);
             if ($data['files'][$i]['original_name'] != eFront_basename($data['files'][$i]['file'])) {
                 if (is_dir(G_ROOTPATH . $newName)) {
                     $file = new EfrontDirectory(G_ROOTPATH . $newName);
                     $file->rename(G_ROOTPATH . dirname($newName) . '/' . EfrontFile::encode(rtrim($data['files'][$i]['original_name'], "/")));
                 }
             }
         }
     }
     unset($data['files']);
     $last_current_node = 0;
     $existing_tree = eF_getContentTree($nouse, $this->lesson['id'], 0, false, false);
     if (sizeof($existing_tree) > 0) {
         $last_current_node = $existing_tree[sizeof($existing_tree) - 1]['id'];
         $first_node = self::eF_import_getTreeFirstChild($data['content']);
         $data['content'][$first_node]['previous_content_ID'] = $last_current_node;
     }
     // MODULES - Import module data
     // Get all modules (NOT only the ones that have to do with the user type)
     $modules = eF_loadAllModules();
     foreach ($modules as $module) {
         if (isset($data[$module->className])) {
             $module->onImportLesson($this->lesson['id'], $data[$module->className]);
             unset($data[$module->className]);
         }
     }
     if (isset($data['glossary_words'])) {
         // to avoid excluding it with the lines below
         $data['glossary'] = $data['glossary_words'];
     }
     $dbtables = eF_showTables();
     //Skip tables that don't exist in current installation, such as modules' tables
     foreach (array_diff(array_keys($data), $dbtables) as $value) {
         unset($data[$value]);
     }
     //tests_to_questions table requires special handling
     //$testsToQuestions = $data['tests_to_questions'];
     //unset($data['tests_to_questions']);
     if (!$data['questions'] && $data['tests_to_questions']) {
         unset($data['tests_to_questions']);
     }
     foreach ($data as $table => $tabledata) {
         /*if ($table == "glossary_words") {
         			 $table = "glossary";
         
         			 } */
         // moved 20 lines above
         if ($table == "lessons") {
             //from v3 lessons parameters also imported
             if ($lessonProperties) {
                 unset($data['lessons']['id']);
                 unset($data['lessons']['directions_ID']);
                 unset($data['lessons']['created']);
                 $this->lesson = array_merge($this->lesson, $data['lessons']);
                 $this->persist();
             }
             eF_updateTableData("lessons", array('info' => $data['lessons']['info'], 'metadata' => $data['lessons']['metadata'], 'options' => $data['lessons']['options']), "id=" . $this->lesson['id']);
             if ($keepName) {
                 eF_updateTableData("lessons", array("name" => $data['lessons']['name']), "id=" . $this->lesson['id']);
                 $this->lesson['name'] = $data['lessons']['name'];
                 eF_updateTableData("f_forums", array("title" => $data['lessons']['name']), "lessons_ID=" . $this->lesson['id']);
             }
         } else {
             if ($table == "questions") {
                 foreach ($tabledata as $key => $value) {
                     unset($tabledata[$key]['timestamp']);
                     $tabledata[$key]['lessons_ID'] = $this->lesson['id'];
                     if ($tabledata[$key]['estimate'] == "") {
                         unset($tabledata[$key]['estimate']);
                     }
                     if (isset($tabledata[$key]['code'])) {
                         //code field removed in version 3.6
                         unset($tabledata[$key]['code']);
                     }
                 }
             }
             if ($table == "tests") {
                 for ($i = 0; $i < sizeof($tabledata); $i++) {
                     if (!isset($tabledata[$i]['options'])) {
                         $tabledata[$i]['options'] = serialize(array('duration' => $tabledata[$i]['duration'], 'redoable' => $tabledata[$i]['redoable'], 'onebyone' => $tabledata[$i]['onebyone'], 'answers' => $tabledata[$i]['answers'], 'given_answers' => $tabledata[$i]['given_answers'], 'shuffle_questions' => $tabledata[$i]['shuffle_questions'], 'shuffle_answers' => $tabledata[$i]['shuffle_answers']));
                         unset($tabledata[$i]['duration']);
                         unset($tabledata[$i]['redoable']);
                         unset($tabledata[$i]['onebyone']);
                         unset($tabledata[$i]['answers']);
                         unset($tabledata[$i]['given_answers']);
                         unset($tabledata[$i]['shuffle_questions']);
                         unset($tabledata[$i]['shuffle_answers']);
                     }
                 }
             }
             if ($table == 'calendar') {
                 $tabledata = array_values($tabledata);
                 // Because export returned assiciative array
                 for ($i = 0; $i < sizeof($tabledata); $i++) {
                     if (isset($tabledata[$i]['lessons_ID'])) {
                         if ($tabledata[$i]['lessons_ID']) {
                             $tabledata[$i]['foreign_ID'] = $tabledata[$i]['lessons_ID'];
                             $tabledata[$i]['type'] = 'lesson';
                         } else {
                             $tabledata[$i]['foreign_ID'] = 0;
                             $tabledata[$i]['type'] = '';
                         }
                         unset($tabledata[$i]['lessons_ID']);
                     }
                     unset($tabledata[$i]['name']);
                     unset($tabledata[$i]['lesson_name']);
                 }
             }
             for ($i = 0; $i < sizeof($tabledata); $i++) {
                 if ($table == "tests") {
                     if (!isset($tabledata[$i]['lessons_ID'])) {
                         $tabledata[$i]['lessons_ID'] = $this->lesson['id'];
                     }
                 }
                 if ($tabledata[$i]) {
                     $sql = "INSERT INTO " . G_DBPREFIX . $table . " SET ";
                     $connector = "";
                     $fields = array();
                     foreach ($tabledata[$i] as $key => $value) {
                         if ($key == "id") {
                             $old_id = $value;
                         } else {
                             if (($table == "content" and $key == "data") || ($table == "questions" and $key == "text") || ($table == "tests" and $key == "description")) {
                                 $value = str_replace("##SERVERNAME##", "", $value);
                                 //$value = str_replace("/##LESSONSLINK##", "content/lessons/".$this -> lesson['id'], $value);
                                 $value = str_replace("##LESSONSLINK##", "content/lessons/" . ($this->lesson['share_folder'] ? $this->lesson['share_folder'] : $this->lesson['id']), $value);
                                 $content_data = $value;
                             } elseif ($key == "lessons_ID") {
                                 $value = $this->lesson['id'];
                             } elseif ($table == "lesson_conditions" and $key == "options") {
                                 if (mb_strpos($data['lesson_conditions'][$i]['type'], "specific") === false) {
                                 } else {
                                     $options = unserialize($data['lesson_conditions'][$i]['options']);
                                     $options[0] = $map['content'][$options[0]];
                                     $value = serialize($options);
                                 }
                             } elseif ($table != "content" and mb_substr($key, -3) == "_ID") {
                                 $from_table = mb_substr($key, 0, -3);
                                 if (isset($map[$from_table][$value])) {
                                     $value = $map[$from_table][$value];
                                 }
                             }
                             if ($table == 'scorm_sequencing_content_to_organization' && $key == 'organization_content_ID') {
                                 $value = $map['content'][$value];
                             }
                             if ($table == 'scorm_sequencing_maps_info' && $key == 'organization_content_ID') {
                                 $value = $map['content'][$value];
                             }
                             if ($table == "content" and $key == 'previous_content_ID' and !$value) {
                                 $value = 0;
                             }
                             if (!($table == "content" and $key == "format")) {
                                 //$sql .= $connector.$key."='".str_replace("'","''",$value)."'";
                                 //$connector = ", ";
                                 $fields[$key] = $value;
                             }
                             if ($table == "content" and $key == "name") {
                                 $content_name = $value;
                             }
                         }
                     }
                     $new_id = eF_insertTableData($table, $fields);
                     if (!$exclude_search) {
                         if ($table == "content") {
                             EfrontSearch::insertText($content_name, $new_id, "content", "title");
                             EfrontSearch::insertText(strip_tags($content_data), $new_id, "content", "data");
                         }
                     }
                     $map[$table][$old_id] = $new_id;
                 }
             }
         }
     }
     if ($data['content']) {
         $map['content'] = array_reverse($map['content'], true);
         foreach ($map['content'] as $old_id => $new_id) {
             eF_updateTableData("content", array('parent_content_ID' => $new_id), "parent_content_ID={$old_id} AND lessons_ID=" . $this->lesson['id']);
             eF_updateTableData("content", array('previous_content_ID' => $new_id), "previous_content_ID={$old_id} AND lessons_ID=" . $this->lesson['id']);
             //eF_updateTableData("questions", array('content_ID' => $new_id), "content_ID=$old_id");
         }
     }
     if ($data['rules']) {
         foreach ($map['content'] as $old_id => $new_id) {
             eF_updateTableData("rules", array('rule_content_ID' => $new_id), "rule_content_ID={$old_id}");
         }
     }
     // Update lesson skill
     $lessonSkillId = $this->getLessonSkill();
     // The lesson offers skill record remains the same
     if ($lessonSkillId) {
         eF_updateTableData("module_hcd_skills", array("description" => _KNOWLEDGEOFLESSON . " " . $this->lesson['name'], "categories_ID" => -1), "skill_ID = " . $lessonSkillId['skill_ID']);
     }
     if ($data['questions']) {
         foreach ($map['questions'] as $old_id => $new_id) {
             eF_updateTableData("tests_to_questions", array('previous_question_ID' => $new_id), "previous_question_ID={$old_id} and tests_ID in (select id from tests where lessons_ID=" . $this->lesson['id'] . ")");
             // Update all questions of not course_only lessons to offer the lessons skill
             if ($lessonSkillId) {
                 eF_insertTableData("questions_to_skills", array("questions_id" => $new_id, "skills_ID" => $lessonSkillId['skill_ID'], "relevance" => 2));
             }
             //eF_insertTableData("questions_to_skills", array("q
             //$questions = eF_getTableDataFlat("questions", "id", "lessons_ID = ". $this ->lesson['id']);
             //eF_deleteTableData("questions_to_skills", "questions_id IN ('".implode("','",$questions['id'])."')");
         }
     }
     foreach ($map['content'] as $old_id => $new_id) {
         //needs debugging
         $content_new_IDs[] = $new_id;
     }
     $content_new_IDs_list = implode(",", $content_new_IDs);
     if ($content_new_IDs_list) {
         $content_data = eF_getTableData("content", "data,id", "id IN ({$content_new_IDs_list}) AND lessons_ID=" . $this->lesson['id']);
     }
     if (isset($replaceString)) {
         for ($i = 0; $i < sizeof($content_data); $i++) {
             $replaced = preg_replace(array_keys($replaceString), array_values($replaceString), $content_data[$i]['data']);
             eF_updateTableData("content", array('data' => $replaced), "id=" . $content_data[$i]['id']);
             if (!$exclude_search) {
                 EfrontSearch::removeText('content', $content_data[$i]['id'], 'data');
                 //Refresh the search keywords
                 EfrontSearch::insertText($replaced, $content_data[$i]['id'], "content", "data");
             }
         }
     }
     if ($content_new_IDs_list) {
         $content_data = eF_getTableData("content", "data,id", "id IN ({$content_new_IDs_list}) AND lessons_ID=" . $this->lesson['id'] . " AND data like '%##EFRONTINNERLINK##%'");
     }
     for ($i = 0; $i < sizeof($content_data); $i++) {
         preg_match_all("/##EFRONTINNERLINK##.php\\?ctg=content&amp;view_unit=(\\d+)/", $content_data[$i]['data'], $regs);
         foreach ($regs[1] as $value) {
             $replaced = str_replace("##EFRONTINNERLINK##.php?ctg=content&amp;view_unit=" . $value, "##EFRONTINNERLINK##.php?ctg=content&amp;view_unit=" . $map["content"][$value], $content_data[$i]['data']);
             eF_updateTableData("content", array('data' => $replaced), "id=" . $content_data[$i]['id']);
             if (!$exclude_search) {
                 EfrontSearch::removeText('content', $content_data[$i]['id'], 'data');
                 //Refresh the search keywords
                 EfrontSearch::insertText($replaced, $content_data[$i]['id'], "content", "data");
             }
         }
     }
     $tests = eF_getTableData("tests t, content c", "t.id, t.name, c.name as c_name", "t.content_ID=c.id");
     foreach ($tests as $test) {
         if (!$test['name']) {
             eF_updateTableData("tests", array("name" => $test['c_name']), "id=" . $test['id']);
         }
     }
     EfrontCache::getInstance()->clearCache();
     return true;
 }
 private function getRssFeeds($refresh = false, $limit = 10)
 {
     //session_write_close();
     $feedTitle = '';
     $feed = 'http://security.efrontlearning.net/feeds/posts/default';
     $str = '';
     if (!$refresh && ($str = EfrontCache::getInstance()->getCache('security_cache:' . $key))) {
         $rssString = $str;
     } else {
         $response = $this->parseFeed($feed);
         !$limit or $response = array_slice($response, 0, $limit);
         foreach ($response as $value) {
             $str .= '<li> ' . formatTimestamp($value['timestamp']) . ' <a href = "' . $value['link'] . '" target = "_NEW">' . $value['title'] . '</a>' . $description . '</li>';
         }
         $rssString = $str;
         EfrontCache::getInstance()->setCache('security_cache:' . $key, $str, 3600);
         //cache for one hour
     }
     return $rssString;
 }
示例#19
0
文件: api.php 项目: bqq1986/efront
     } else {
         echo "<xml>";
         echo "<status>error</status>";
         echo "<message>Invalid token</message>";
         echo "</xml>";
     }
     break;
 case 'deactivate_user_course':
     if (isset($_GET['token']) && checkToken($_GET['token'])) {
         if (isset($_GET['login']) && isset($_GET['course'])) {
             $update['from_timestamp'] = 0;
             $courses = eF_getTableData("lessons_to_courses", "lessons_id", "courses_ID=" . $_GET['course']);
             for ($i = 0; $i < sizeof($courses); $i++) {
                 if (eF_updateTableData("users_to_lessons", $update, "users_LOGIN='******'login'] . "' and lessons_ID=" . $courses[$i]['lessons_id'])) {
                     $cacheKey = "user_lesson_status:lesson:" . $courses[$i]['lessons_id'] . "user:"******"<xml>";
             echo "<status>ok</status>";
             echo "</xml>";
         } else {
             echo "<xml>";
             echo "<status>error</status>";
             echo "<message>Incomplete arguments</message>";
             echo "</xml>";
         }
     } else {
         echo "<xml>";
         echo "<status>error</status>";
         echo "<message>Invalid token</message>";
示例#20
0
 private function getRssFeeds($refresh = false)
 {
     //session_write_close();
     $feedTitle = '';
     $feeds = $this->getFeeds(true);
     foreach ($feeds as $key => $feed) {
         $str = '';
         if ($feed['lessons_ID'] && $_SESSION['s_lessons_ID'] && $feed['lessons_ID'] != $_SESSION['s_lessons_ID']) {
             unset($feeds[$key]);
         } else {
             if (!$refresh && ($str = EfrontCache::getInstance()->getCache('rss_cache:' . $key))) {
                 $rssStrings[] = $str;
             } else {
                 if ($feed['title'] != $feedTitle) {
                     $feedTitle = '<li style = "display:none;font-weight:bold" onmouseover = "pauseList()" onmouseout = "continueList()"> ' . _RSS_NEWSFROM . ' &quot;<span style = "font-style:italic">' . $feed['title'] . '</span>&quot;</li>';
                     $str .= $feedTitle;
                 }
                 $response = $this->parseFeed($feed);
                 foreach ($response as $value) {
                     if (!$feed['only_summary']) {
                         $description = strip_tags($value['description']);
                         if (mb_strlen($description) > 100) {
                             $description = mb_substr($description, 0, 100) . '...';
                         }
                         $description = '<div style = "font-style:italic;margin-left:10px">' . $description . '</div>';
                     }
                     $str .= '<li style = "display:none" onmouseover = "pauseList()" onmouseout = "continueList()"> ' . formatTimestamp($value['timestamp']) . ' <a href = "' . $value['link'] . '" target = "_NEW">' . $value['title'] . '</a>' . $description . '</li>';
                 }
                 $rssStrings[] = $str;
                 EfrontCache::getInstance()->setCache('rss_cache:' . $key, $str, 3600 * 24);
             }
         }
     }
     $rssString = implode("", $rssStrings);
     return $rssString;
 }
 /**
  * Delete configuration value
  *
  * This function deletes the specified value from the configuration table and variable
  * @param string $name The variable name
  * @since 3.6.8
  * @access public
  * @static
  */
 public static function deleteValue($name)
 {
     EfrontCache::getInstance()->deleteCache('configuration');
     eF_deleteTableData("configuration", "name = '{$name}'");
     unset($GLOBALS['configuration'][$name]);
 }
示例#22
0
 /**
  * Instantiate tree object
  *
  * The constructor instantiates the tree based on the lesson id
  * <br/>Example:
  * <code>
  * $tree = new EfrontContentTree(23);                   //23 is the lesson id
  * $lesson = new EfrontLesson(23);                      //23 is the lesson id
  * $tree = new EfrontContentTree($lesson);              //Content may be alternatively instantiated using the lesson object
  * </code>
  *
  * @param mixed $lesson Either The lesson id or an EfrontLesson object
  * @param array $data If true, then the tree nodes hold data as well
  * @since 3.5.0
  * @access public
  */
 function __construct($lesson, $data = false)
 {
     if ($lesson instanceof EfrontLesson) {
         $lessonId = $lesson->lesson['id'];
     } elseif (!eF_checkParameter($lesson, 'id')) {
         throw new EfrontContentException(_INVALIDLESSONID . ': ' . $lesson, EfrontContentException::INVALID_ID);
     } else {
         $lessonId = $lesson;
     }
     $this->lessonId = $lessonId;
     //Set the lesson id
     $parameters = "content_tree:{$lessonId}";
     if (!$data && ($tree = unserialize(EfrontCache::getInstance()->getCache($parameters))) !== false) {
         $this->tree = $tree;
     } else {
         $this->data = $data;
         //Is used in reset()
         $this->reset();
         //Initialize content tree
         if (!$data) {
             EfrontCache::getInstance()->setCache($parameters, serialize($this->tree), 3600);
         }
     }
     $firstUnit = $this->getFirstNode();
     $this->currentUnitId = $firstUnit['id'];
 }
 /**
  * Set user role
  *
  * This function is used to set the specific role of this user.
  * <br/>Example:
  * <code>
  * $user -> setRole(23, 'simpleUser');		  //Set this user's role to 'simpleUser' for lesson with id 23
  * $user -> setRole(23);						//Set this user's role to the same as its basic type (for example 'student') for lesson with id 23
  * $user -> setRole(false, 'simpleUser');	   //Set this user's role to 'simpleUser' for all lessons
  * $user -> setRole();						  //Set this user's role to the same as its basic type (for example 'student') for all lessons
  * </code>
  *
  * @param int $lessonId The lesson id
  * @param string $userRole The new user role
  * @return boolean true if everything is ok
  * @since 3.5.0
  * @access public
  */
 public function setRole($lessonId = false, $userRole = false)
 {
     if ($userRole) {
         $fields = array("user_type" => $userRole);
     } else {
         $fields = array("user_type" => $this->user['user_type']);
     }
     if ($lessonId && eF_checkParameter($lessonId, 'id')) {
         eF_updateTableData("users_to_lessons", $fields, "users_LOGIN='******'login'] . "' and lessons_ID={$lessonId}");
         $cacheKey = "user_lesson_status:lesson:" . $lessonId . "user:"******"users_to_lessons", $fields, "users_LOGIN='******'login'] . "'");
     }
 }
示例#24
0
    #cpp#endif
}
#cpp#endif
$userMainForm->setDefaults($GLOBALS['configuration']);
if (isset($currentUser->coreAccess['configuration']) && $currentUser->coreAccess['configuration'] != 'change') {
    $userMainForm->freeze();
} else {
    $userMainForm->addElement("submit", "submit", _SAVE, 'class = "flatButton"');
    if ($userMainForm->isSubmitted() && $userMainForm->validate()) {
        pr($_POST);
        $values = $userMainForm->exportValues();
        if ($values['reset_license_note'] || $values['reset_license_note_always']) {
            eF_updateTableData("users", array("viewed_license" => 0), "viewed_license = 1");
        }
        if ($values['username_format']) {
            EfrontCache::getInstance()->deleteCache(G_DBNAME . ':_usernames');
        }
        if ($values['time_reports'] != $GLOBALS['configuration']['time_reports']) {
            EfrontSystem::switchLessonReportingMode($values['time_reports']);
        }
        unset($values['reset_license_note']);
        //Unset it, since we don't need to store this value to the database
        unset($values['submit']);
        foreach ($values as $key => $value) {
            EfrontConfiguration::setValue($key, $value);
        }
        eF_redirect(basename($_SERVER['PHP_SELF']) . "?ctg=system_config&op=user&tab=main&message=" . urlencode(_SUCCESFULLYUPDATECONFIGURATION) . "&message_type=success");
    }
}
$smarty->assign("T_USER_MAIN_FORM", $userMainForm->toArray());
$userMultipleLoginsForm = new HTML_QuickForm("user_multiple_logins_form", "post", basename($_SERVER['PHP_SELF']) . "?ctg=system_config&op=user&tab=multiple_logins", "", null, true);