当前位置: 首页>>代码示例>>PHP>>正文


PHP eF_insertTableData函数代码示例

本文整理汇总了PHP中eF_insertTableData函数的典型用法代码示例。如果您正苦于以下问题:PHP eF_insertTableData函数的具体用法?PHP eF_insertTableData怎么用?PHP eF_insertTableData使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了eF_insertTableData函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: create

 /**
  * Create comments
  * 
  * This function is used to create comments
  * <br>Example:
  * <code>
  * $comments = comments :: create($fields));			//$fields is an array of data for the comment
  * </code>
  * 
  * @param $fields An array of data
  * @return comments The new object
  * @since 3.6.0
  * @access public
  * @static
  */
 public static function create($fields = array())
 {
     $fields = array("data" => $fields['data'], "users_LOGIN" => $fields['users_LOGIN'], "content_ID" => $fields['content_ID'], "private" => $fields['private'], "timestamp" => isset($fields['timestamp']) && $fields['timestamp'] ? $fields['timestamp'] : time(), "active" => !isset($fields['active']) || $fields['active'] ? 1 : 0);
     $newId = eF_insertTableData("comments", $fields);
     $comments = new comments($newId);
     $sourceUnit = new EfrontUnit($fields['content_ID']);
     EfrontEvent::triggerEvent(array("type" => EfrontEvent::NEW_COMMENT_WRITING, "lessons_ID" => $sourceUnit['lessons_ID'], "entity_ID" => $fields['content_ID'], "entity_name" => $sourceUnit['name']));
     return $comments;
 }
开发者ID:bqq1986,项目名称:efront,代码行数:24,代码来源:comments.class.php

示例2: create

 /**
  * Create calendar
  *
  * This function is used to create calendar
  *
  * @param $fields An array of data
  * @return calendar The new object
  * @since 3.6.7
  * @access public
  * @static
  */
 public static function create($fields = array())
 {
     $fields = array('data' => $fields['data'], 'timestamp' => $fields['timestamp'] ? $fields['timestamp'] : time(), 'active' => isset($fields['active']) && $fields['active'] ? 1 : 0, 'type' => $fields['type'], 'foreign_ID' => $fields['foreign_ID'], 'users_LOGIN' => $fields['users_LOGIN']);
     $newId = eF_insertTableData("calendar", $fields);
     $result = eF_getTableData("calendar", "*", "id=" . $newId);
     //We perform an extra step/query for retrieving data, sinve this way we make sure that the array fields will be in correct order (forst id, then name, etc)
     $calendar = new calendar($result[0]['id']);
     return $calendar;
 }
开发者ID:kaseya-university,项目名称:efront,代码行数:20,代码来源:calendar.class.php

示例3: insertText

 /**
  * Function insertText()
  *
  * This function registers a new keyword to the search table. Input arguments are:
  * - The keyword to be commited
  * - The id of the database entry in the keyword original table
  * - This table's name.
  * - Whether the keyword lies on the title or the body of the containing text
  *
  * @param string $text The search keyword
  * @param int $foreignID The keyword's original entry id
  * @param string $tableName The keyword's original table name
  * @param string $position The keyword's original text position, either 'title' or 'data'.
  * @since 3.5.0
  * @access public
  */
 public static function insertText($text, $foreignID, $tableName, $position)
 {
     $fields['foreign_ID'] = $foreignID;
     $fields['table_name'] = EfrontSearch::$tableAssoc[$tableName];
     //from 3.6 there is a corespondence between tables and numbers
     $position == "title" ? $fields['position'] = 0 : ($fields['position'] = 1);
     //from 3.6  1 means 'data' and 0 means 'title'
     //todo : remove also some special chars like [ ] & * etc
     if ($text == "") {
         return true;
     }
     $replace = array("&nbsp;", "(", "{", "}", ")", "]", "[", "@", "#", "\$", "%", "^", "&", "*", ".", ",", "'", "\"", "/", "\\");
     $querywords = mb_strtolower(strip_tags(str_replace($replace, " ", $text)));
     $eachword = explode(" ", $querywords);
     $eachword = array_unique($eachword);
     //Remove duplicate values from search table
     $terms = array();
     foreach ($eachword as $key => $value) {
         $len = mb_strlen($value);
         if ($len > 3 and $len < 100) {
             //Only words with length more than 3 and less than 100 characters long.
             $terms[] = $value;
         } else {
         }
     }
     //Querying for all values may be very slow; this is why we added this 20 values limit
     if (sizeof($terms) > 20) {
         $result = eF_getTableDataFlat("search_invertedindex", "id,keyword");
     } else {
         $terms = array_map(create_function('$x', 'return htmlspecialchars($x, ENT_QUOTES, "utf-8");'), $terms);
         $result = eF_getTableDataFlat("search_invertedindex", "*", "keyword IN ('" . implode("','", $terms) . "')");
     }
     isset($result["keyword"]) && $result["keyword"] ? $allTerms = $result["keyword"] : ($allTerms = array());
     if (!empty($terms)) {
         foreach ($terms as $key => $value) {
             $position = array_search($value, $allTerms);
             //array_search may also return null!
             if ($position === false && !is_null($position)) {
                 $newId = eF_insertTableData("search_invertedindex", array("keyword" => $value));
                 //$fields['keyword'] = $newId;
                 $allFields[] = $fields + array('keyword' => $newId);
                 //$rows[] = "('".implode("','",$fields)."')";
             } else {
                 //$fields['keyword'] = $result["id"][$position];
                 $allFields[] = $fields + array('keyword' => $result["id"][$position]);
                 //$rows[] = "('".implode("','",$fields)."')";
             }
         }
         $allFields = array_map('unserialize', array_unique(array_map('serialize', $allFields)));
         //$res = eF_executeNew("insert into search_keywords (".implode(",", array_keys($fields)).") values ".implode(",",$rows)."");
         eF_insertTableDataMultiple("search_keywords", $allFields);
     }
     return true;
 }
开发者ID:jiangjunt,项目名称:efront_open_source,代码行数:70,代码来源:search.class.php

示例4: create

 /**
  * Create glossary
  *
  * This function is used to create glossary
  * <br>Example:
  * <code>
  * $fields = array("title"       => $form -> exportValue('title'),
  *       "data"        => $form -> exportValue('data'),
  *       "timestamp"   => $from_timestamp,
  *		 "expire"      => $to_timestamp,
  *       "lessons_ID"  => isset($_SESSION['s_lessons_ID']) && $_SESSION['s_lessons_ID'] ? $_SESSION['s_lessons_ID'] : 0,
  *       "users_LOGIN" => $_SESSION['s_login']);
  *
  * $glossary = glossary :: create($fields, 0));
  *
  * </code>
  *
  * @param $fields An array of data
  * @return glossary The new object
  * @since 3.6.0
  * @access public
  * @static
  */
 public static function create($fields = array())
 {
     // added to fix http://forum.efrontlearning.net/viewtopic.php?f=5&t=2851&p=14715
     if (mb_substr($fields['info'], 0, 3) == "<p>") {
         $fields['info'] = mb_substr($fields['info'], 3);
         if (mb_substr($fields['info'], -4, 4) == "</p>") {
             $fields['info'] = mb_substr($fields['info'], 0, -4);
         }
     }
     $fields = array("name" => $fields['name'], "info" => $fields['info'], "lessons_ID" => $fields['lessons_ID'], "type" => isset($fields['type']) && $fields['type'] ? $fields['type'] : "general");
     //    "active"     => isset($fields['active'])&& $fields['active'] ? 1 : 0);  //not implemented yet
     $newId = eF_insertTableData("glossary", $fields);
     $glossary = new glossary($newId);
     //pr($glossary);exit;
     EfrontSearch::insertText($glossary->glossary['name'], $glossary->glossary['id'], "glossary", "title");
     EfrontSearch::insertText($glossary->glossary['info'], $glossary->glossary['id'], "glossary", "data");
     return $glossary;
 }
开发者ID:bqq1986,项目名称:efront,代码行数:41,代码来源:glossary.class.php

示例5: create

 /**
  * Create news
  *
  * This function is used to create news
  * <br>Example:
  * <code>
  * $fields = array("title"       => $form -> exportValue('title'),
  *       "data"        => $form -> exportValue('data'),
  *       "timestamp"   => $from_timestamp,
  *		 "expire"      => $to_timestamp,
  *       "lessons_ID"  => isset($_SESSION['s_lessons_ID']) && $_SESSION['s_lessons_ID'] ? $_SESSION['s_lessons_ID'] : 0,
  *       "users_LOGIN" => $_SESSION['s_login']);
  *
  * $news = news :: create($fields, 0));
  *
  * </code>
  *
  * @param $fields An array of data
  * @param $sendEmail Whether to send the announcement as an email as well
  * @return news The new object
  * @since 3.6.0
  * @access public
  * @static
  */
 public static function create($fields = array(), $sendEmail = false)
 {
     $fields = array('title' => $fields['title'], 'data' => $fields['data'], 'timestamp' => $fields['timestamp'] ? $fields['timestamp'] : time(), 'expire' => $fields['expire'] ? $fields['expire'] : null, 'lessons_ID' => $fields['lessons_ID'], 'users_LOGIN' => $fields['users_LOGIN']);
     $newId = eF_insertTableData("news", $fields);
     $result = eF_getTableData("news", "*", "id=" . $newId);
     //We perform an extra step/query for retrieving data, sinve this way we make sure that the array fields will be in correct order (forst id, then name, etc)
     $news = new news($result[0]['id']);
     if ($news->news['lessons_ID']) {
         //EfrontEvent::triggerEvent(array("type" => EfrontEvent::NEW_LESSON_ANNOUNCEMENT, "users_LOGIN" => $fields['users_LOGIN'], "users_name" => $currentUser -> user['name'], "users_surname" => $currentUser -> user['surname'], "lessons_ID" => $fields['lessons_ID'], "entity_ID" => $id, "entity_name" => $news_content['title']), isset($_POST['email']));
         EfrontEvent::triggerEvent(array("type" => EfrontEvent::NEW_LESSON_ANNOUNCEMENT, "users_LOGIN" => $GLOBALS['currentUser']->user['login'], "users_name" => $GLOBALS['currentUser']->user['name'], "users_surname" => $GLOBALS['currentUser']->user['surname'], "lessons_ID" => $GLOBALS['currentLesson']->lesson['id'], "lessons_name" => $GLOBALS['currentLesson']->lesson['name'], "entity_name" => $fields['title'], "entity_ID" => $newId), $sendEmail);
     } else {
         //EfrontEvent::triggerEvent(array("type" => EfrontEvent::NEW_SYSTEM_ANNOUNCEMENT, "users_LOGIN" => $fields['users_LOGIN'], "users_name" => $currentUser -> user['name'], "users_surname" => $currentUser -> user['surname'], "entity_ID" => $id, "entity_name" => $news_content['title']), isset($_POST['email']));
         EfrontEvent::triggerEvent(array("type" => EfrontEvent::NEW_SYSTEM_ANNOUNCEMENT, "users_LOGIN" => $GLOBALS['currentUser']->user['login'], "users_name" => $GLOBALS['currentUser']->user['name'], "users_surname" => $GLOBALS['currentUser']->user['surname'], "lessons_name" => $GLOBALS['currentLesson']->lesson['name'], "entity_name" => $fields['title'], "entity_ID" => $newId), $sendEmail);
     }
     EfrontSearch::insertText($news->news['title'], $news->news['id'], "news", "title");
     EfrontSearch::insertText($news->news['data'], $news->news['id'], "news", "data");
     return $news;
 }
开发者ID:kaseya-university,项目名称:efront,代码行数:42,代码来源:news.class.php

示例6: time

         echo "<xml>";
         echo "<status>error</status>";
         echo "<message>Invalid token</message>";
         echo "</xml>";
     }
     break;
 case 'lesson_to_user':
     if (isset($_GET['token']) && checkToken($_GET['token'])) {
         if (isset($_GET['login']) && isset($_GET['lesson'])) {
             $insert['users_LOGIN'] = $_GET['login'];
             $insert['lessons_ID'] = $_GET['lesson'];
             $insert['active'] = '1';
             $insert['from_timestamp'] = time();
             $res = eF_getTableData("users_to_lessons", "*", "users_LOGIN='" . $_GET['login'] . "' and lessons_ID=" . $_GET['lesson']);
             if (sizeof($res) == 0) {
                 eF_insertTableData("users_to_lessons", $insert);
                 echo "<xml>";
                 echo "<status>ok</status>";
                 echo "</xml>";
             } else {
                 echo "<xml>";
                 echo "<status>error</status>";
                 echo "<message>Assignment already exists</message>";
                 echo "</xml>";
             }
         } else {
             echo "<xml>";
             echo "<status>error</status>";
             echo "<message>Incomplete arguments</message>";
             echo "</xml>";
         }
开发者ID:bqq1986,项目名称:efront,代码行数:31,代码来源:api.php

示例7: importData


//.........这里部分代码省略.........
                     // this denotes to the createJob class to put the job in all branches
                 } else {
                     $data['branch_ID'] = $this->getBranchByName($data['branch_name']);
                     if (sizeof($data['branch_ID']) > 0) {
                         //TODO: maybe different handling when multiple branches are found
                         $data['branch_ID'] = $data['branch_ID'][0];
                     } else {
                         throw new EfrontJobException(_BRANCHDESIGNATEDFORTHISJOBDESCRIPTIONDOESNOTEXIST, EfrontJobException::BRANCH_NOT_EXISTS);
                     }
                 }
                 unset($data['branch_name']);
                 if ($data['description'] != "") {
                     $job_ID = $this->getJobByName($data['description']);
                     if (sizeof($job_ID) > 0) {
                         $data['job_description_ID'] = $job_ID[0];
                         throw new EfrontJobException(_JOBDESCRIPTIONEXISTSALREADY, EfrontJobException::JOB_ALREADY_EXISTS);
                     } else {
                         EfrontJob::createJob($data);
                         $this->log["success"][] = _LINE . " {$line}: " . _NEWJOB . " " . $data['description'];
                     }
                 } else {
                     $this->log["failure"][] = _LINE . " {$line}: " . _NOTITLEPROVIDEDFORNEWJOB;
                 }
                 break;
             case "skills":
                 if ($data['skill_category'] == "") {
                     throw new EfrontSkillException(_MISSINGSKILLCATEGORY, EfrontSkillException::INVALID_SKILL_CATEGORY);
                 } else {
                     $data['categories_ID'] = $this->getSkillCategoryByName($data['skill_category']);
                     if ($data['categories_ID'][0] != "") {
                         $data['categories_ID'] = $data['categories_ID'][0];
                     } else {
                         // create skill category
                         $data['categories_ID'] = eF_insertTableData("module_hcd_skill_categories", array('description' => $data['skill_category']));
                         $this->setSkillCategoryByName($data['skill_category'], $data['categories_ID']);
                     }
                 }
                 unset($data['skill_category']);
                 $skill_ID = $this->getSkillByName($data['description']);
                 if ($skill_ID) {
                     //TODO: another double issue
                     $data['skill_ID'] = $skill_ID[0];
                     throw new EfrontSkillException(_SKILLALREADYEXISTS, EfrontSkillException::SKILL_EXISTS);
                 } else {
                     EfrontSkill::createSkill($data);
                     $this->log["success"][] = _LINE . " {$line}: " . _NEWSKILL . " " . $data['description'];
                 }
                 break;
             case "users_to_jobs":
                 // Get user
                 $user = EfrontUserFactory::factory($data["users_login"]);
                 // Get branch id
                 $branch_ID = $this->getBranchByName($data['branch_name']);
                 $branch_name = $data['branch_name'];
                 if ($branch_ID[0] != "") {
                     if (sizeof($branch_ID) == 1) {
                         $branch_ID = $branch_ID[0];
                     } else {
                         throw new EfrontBranchException(_BRANCHNAMEAMBIGUOUS, EfrontBranchException::BRANCH_AMBIGUOUS);
                     }
                 } else {
                     throw new EfrontBranchException(_BRANCHDOESNOTEXIST, EfrontBranchException::BRANCH_NOT_EXISTS);
                 }
                 // Get job id
                 $job_name = $data['description'];
                 if ($job_name != "") {
开发者ID:bqq1986,项目名称:efront,代码行数:67,代码来源:import_export.class.php

示例8: HTML_QuickForm_Renderer_ArraySmarty

                                    }
                                    $form->setDefaults(array('previous_url' => $previous_url));
                                    $form->addElement('submit', 'submit_topic_details', _SUBMIT, 'class = "flatButton" tabindex="2"');
                                    if (isset($_GET['edit_topic'])) {
                                        $form->setDefaults(array('topic_description' => $topic[0]['title']));
                                    }
                                    $renderer = new HTML_QuickForm_Renderer_ArraySmarty($smarty);
                                    $renderer->setRequiredTemplate('{$html}{if $required}
							&nbsp;<span class = "formRequired">*</span>
						{/if}');
                                    //LESSONTIMELINE DATA SUBMISSION
                                    if ($form->isSubmitted()) {
                                        if ($form->validate()) {
                                            $topic_content = array('title' => $form->exportValue('topic_description'), 'lessons_ID' => $currentLesson->lesson['id']);
                                            if (isset($_GET['add_topic'])) {
                                                eF_insertTableData("lessons_timeline_topics", $topic_content);
                                                $message = _SUCCESSFULLYCREATEDLESSONTIMELINETOPIC;
                                                $message_type = 'success';
                                            } elseif (isset($_GET['edit_topic'])) {
                                                eF_updateTableData("lessons_timeline_topics", $topic_content, "id = '" . $_GET['edit_topic'] . "'");
                                                $message = _LESSONTIMELINETOPICDATAUPDATED;
                                                $message_type = 'success';
                                            }
                                            // Return to previous url stored in a hidden - that way, after the insertion we can immediately return to where we were
                                            echo "<script>!/\\?/.test(parent.location) ? parent.location = '" . basename($form->exportValue('previous_url')) . "&message=" . urlencode($message) . "&message_type=" . $message_type . "' : parent.location = '" . basename($form->exportValue('previous_url')) . "&message=" . urlencode($message) . "&message_type=" . $message_type . "';</script>";
                                            //eF_redirect("".$form->exportValue('previous_url')."&message=". $message . "&message_type=" . $message_type . "&tab=skills");
                                            exit;
                                        }
                                    }
                                    $form->setJsWarnings(_BEFOREJAVASCRIPTERROR, _AFTERJAVASCRIPTERROR);
                                    $form->setRequiredNote(_REQUIREDNOTE);
开发者ID:kaseya-university,项目名称:efront,代码行数:31,代码来源:social.php

示例9: onDeleteTheme

 /**
  * (non-PHPdoc)
  * @see libraries/EfrontModule#onDeleteTheme()
  */
 public function onDeleteTheme($theme)
 {
     eF_insertTableData("module_vLab_data", array("timestamp" => time(), "data" => str_replace('%theme%', $theme, _MODULE_VLAB_DELETETHEME)));
 }
开发者ID:kaseya-university,项目名称:efront,代码行数:8,代码来源:module_vLab.class.php

示例10: basename

             $redirectUrl .= "&message_type=" . $message_type . "&reset_popup=1";
             $smarty->assign('T_CLONE_CERTIFICATE_TEMPLATE_REDIRECT', $redirectUrl);
         }
         $tid = $_GET['template_id'];
         $postTarget = basename($_SERVER['PHP_SELF']) . '?' . $baseUrl . '&op=clone_certificate_template&template_id=' . $tid;
         $form = new HTML_QuickForm("clone_certificate_template_form", "post", $postTarget, "", null, true);
         $form->registerRule('checkParameter', 'callback', 'eF_checkParameter');
         // Register this rule for checking user input with eF_checkParameter
         $form->addElement('text', 'certificate_name', _CERTIFICATENAME, 'class="inputText"');
         $form->addRule('certificate_name', _THEFIELD . ' "' . _CERTIFICATENAME . '" ' . _ISMANDATORY, 'required', null, 'client');
         $form->addElement('submit', 'clone_certificate_template', _SAVE, 'class="flatButton"');
         if ($form->isSubmitted() && $form->validate()) {
             $cloneTemplate = eF_getTableData("certificate_templates", "certificate_xml", "id=" . $tid);
             $formValues = $form->exportValues();
             $dbFields = array("certificate_name" => $formValues['certificate_name'], "certificate_xml" => $cloneTemplate[0]['certificate_xml'], "certificate_type" => "course", "users_LOGIN" => $GLOBALS['currentUser']->user['login']);
             if ($cloned = eF_insertTableData("certificate_templates", $dbFields)) {
                 $message = _SUCCESSFULLYCLONECERTIFICATETEMPLATE;
                 $message_type = 'success';
             } else {
                 $message = _PROBLEMCLONECERTIFICATETEMPLATE;
                 $message_type = 'failure';
             }
             $redirectUrl = "" . basename($_SERVER['PHP_SELF']) . "?" . $baseUrl . "&op=format_certificate&message=" . urlencode($message);
             $redirectUrl .= "&message_type=" . $message_type . "&reset_popup=1&tid=" . $cloned;
             $smarty->assign('T_CLONE_CERTIFICATE_TEMPLATE_REDIRECT', $redirectUrl);
         }
         $renderer = prepareFormRenderer($form);
         $smarty->assign('T_CLONE_CERTIFICATE_TEMPLATE_FORM', $renderer->toArray());
     }
     #cpp#endif
 } else {
开发者ID:kaseya-university,项目名称:efront,代码行数:31,代码来源:course_settings.php

示例11: setValue

 /**
  * Set configuration value
  *
  * This function is used to set a configuration value. Given a name/value pair,
  * this function first checks if it exists in the 'configuration' database table.
  * If so, it updates the variable with the new value, otherwise it inserts a new
  * entry.
  * <br/>Example:
  * <code>
  * $defaultConfig = EfrontConfiguration :: setValue('smtp_host', 'localhost');			//Set the configuration parameter 'smtp_host' to 'localhost'
  * </code>
  *
  * @param string $name The variable name
  * @param string $value The variable value
  * @return boolean The query result
  * @access public
  * @since 3.0
  * @static
  */
 public static function setValue($name, $value)
 {
     $value = trim($value);
     try {
         eF_insertTableData("configuration", array('name' => $name, 'value' => $value));
     } catch (Exception $e) {
         //If exists, update it
         eF_updateTableData("configuration", array('value' => $value), "name = '{$name}'");
     }
     $GLOBALS['configuration'][$name] = $value;
     EfrontCache::getInstance()->deleteCache('configuration');
     return true;
 }
开发者ID:kaseya-university,项目名称:efront,代码行数:32,代码来源:configuration.class.php

示例12: assignBranch

 /**
  * Assign a branch to this course
  *
  * This function is used to correlate a branch to the course
  * All users of the branch should be assigned to this course
  *
  * <br/>Example:
  * <code>
  * $course -> assignBranch(2);   // The course will be assigned to branch with id 2
  * </code>
  *
  * @param $branch_ID the id of the branch to be assigned
  * @return boolean true/false
  * @since 3.6.0
  * @access public
  */
 public function assignBranch($branch_ID)
 {
     $this->getBranches();
     // Check if the branch is not assigned as offered by this course
     if ($this->branches[$branch_ID]['courses_ID'] == "") {
         eF_insertTableData("module_hcd_course_to_branch", array("branches_ID" => $branch_ID, "courses_ID" => $this->course['id']));
         $this->branches[$branch_ID]['courses_ID'] = $this->course['id'];
         $newBranch = new EfrontBranch($branch_ID);
         $employees = $newBranch->getEmployees(false, true);
         //get data flat
         $this->addUsers($employees['login'], $employees['user_type']);
     }
     return true;
 }
开发者ID:kaseya-university,项目名称:efront,代码行数:30,代码来源:course.class.php

示例13: EfrontDirectory

             $message = _PERMITTEDROLESMODULEERROR;
             $message_type = 'failure';
             $roles_failure = 1;
         }
     }
 }
 if ($roles_failure) {
     $dir = new EfrontDirectory(G_MODULESPATH . $module_folder . '/');
     $dir->delete();
 } else {
     $fields = array('className' => $className, 'db_file' => $database_file, 'name' => $className, 'active' => 1, 'title' => (string) $xml->title ? (string) $xml->title : " ", 'author' => (string) $xml->author, 'version' => (string) $xml->version, 'description' => (string) $xml->description, 'position' => $module_position, 'permissions' => implode(",", $module->getPermittedRoles()));
     if (!isset($_GET['upgrade'])) {
         // Install module database
         try {
             if ($module->onInstall()) {
                 eF_insertTableData("modules", $fields);
                 $message = _MODULESUCCESFULLYINSTALLED;
                 $message_type = 'success';
                 eF_redirect("" . basename($_SERVER['PHP_SELF']) . "?ctg=modules&message=" . urlencode($message) . "&message_type=" . $message_type . "&refresh_side=1");
             } else {
                 $message = _MODULEDBERRORONINSTALL;
                 $message_type = 'failure';
                 $dir = new EfrontDirectory(G_MODULESPATH . $module_folder . '/');
                 $dir->delete();
                 //eF_deleteFolder(G_MODULESPATH.$module_folder.'/');
             }
         } catch (Exception $e) {
             $module->onUninstall();
             $message = _PROBLEMINSERTINGPARSEDXMLVALUESORMODULEEXISTS;
             $message_type = 'failure';
             //$dir = new EfrontDirectory(G_MODULESPATH.$module_folder.'/');
开发者ID:bqq1986,项目名称:efront,代码行数:31,代码来源:modules.php

示例14: getModule


//.........这里部分代码省略.........
                 }
             }
             $branchCourses = array();
             foreach ($result as $value) {
                 $branchCourses[$value['courses_ID']] = $value['courses_ID'];
             }
             foreach ($events as $key => $value) {
                 if (!isset($branchCourses[$key]) && !isset($userCourses[$key])) {
                     unset($events[$key]);
                 }
             }
         } else {
             foreach ($events as $key => $value) {
                 if (!isset($userCourses[$key])) {
                     unset($events[$key]);
                 }
             }
         }
     }
     if (!isset($_GET['course'])) {
         $dataSource = $events;
         $tableName = 'outlookInvitationsTable';
         isset($_GET['limit']) && eF_checkParameter($_GET['limit'], 'uint') ? $limit = $_GET['limit'] : ($limit = G_DEFAULT_TABLE_SIZE);
         if (isset($_GET['sort']) && eF_checkParameter($_GET['sort'], 'text')) {
             $sort = $_GET['sort'];
             isset($_GET['order']) && $_GET['order'] == 'desc' ? $order = 'desc' : ($order = 'asc');
         } else {
             $sort = 'login';
         }
         $dataSource = eF_multiSort($dataSource, $sort, $order);
         $smarty->assign("T_TABLE_SIZE", sizeof($dataSource));
         if (isset($_GET['filter'])) {
             $dataSource = eF_filterData($dataSource, $_GET['filter']);
         }
         if (isset($_GET['limit']) && eF_checkParameter($_GET['limit'], 'int')) {
             isset($_GET['offset']) && eF_checkParameter($_GET['offset'], 'int') ? $offset = $_GET['offset'] : ($offset = 0);
             $dataSource = array_slice($dataSource, $offset, $limit);
         }
         $smarty->assign("T_DATA_SOURCE", $dataSource);
     } else {
         $course = new EfrontCourse($_GET['course']);
         $form = new HTML_QuickForm("import_outlook_invitation_form", "post", $this->moduleBaseUrl . "&course={$course->course['id']}&add_event=1" . (isset($_GET['popup']) ? '&popup=1' : ''), "", null, true);
         $form->registerRule('checkParameter', 'callback', 'eF_checkParameter');
         //Register this rule for checking user input with our function, eF_checkParameter
         $form->addElement('text', 'email', _SENDER, 'class = "inputText"');
         $form->addElement('text', 'location', _LOCATION, 'class = "inputText"');
         $form->addElement('text', 'subject', _SUBJECT, 'class = "inputText"');
         $form->addElement('textarea', 'description', _DESCRIPTION, 'class = "inputTestTextarea" style = "width:80%;height:6em;"');
         //$form -> addElement('checkbox', 'calendar', _MODULE_OUTLOOK_INVITATION_CREATE_CALENDAR);
         //$form -> addElement('static', 'static', _MODULE_OUTLOOK_INVITATION_INFO);
         $form->addElement('submit', 'submit_event_all', _MODULE_OUTLOOK_INVITATION_SENDALL, 'class=flatButton');
         $form->addElement('submit', 'submit_event_new', _MODULE_OUTLOOK_INVITATION_SENDNEW, 'class=flatButton');
         if (empty($events[$course->course['id']])) {
             //new invitation
             $currentEvent = null;
             $form->setDefaults(array('email' => $currentUser->user['email'], 'subject' => 'Invitation to attend training: ' . $course->course['name']));
         } else {
             //existing invitation
             $currentEvent = $events[$course->course['id']];
             $form->setDefaults(array('email' => $currentEvent['email'], 'description' => $currentEvent['description'], 'subject' => $currentEvent['subject'], 'location' => $currentEvent['location']));
         }
         if ($form->isSubmitted() && $form->validate()) {
             try {
                 $message = "";
                 // Set info to store into database
                 $permanent_info = array("courses_ID" => $course->course['id'], "email" => $form->exportValue('email') ? $form->exportValue('email') : $GLOBALS['configuration']['system_email'], "location" => $form->exportValue('location'), "subject" => $form->exportValue('subject'), "description" => $form->exportValue('description'));
                 if ($currentEvent) {
                     $permanent_info['sequence'] = $currentEvent['sequence'] + 1;
                     eF_updateTableData("module_outlook_invitation", $permanent_info, "courses_ID={$course->course['id']}");
                 } else {
                     eF_insertTableData("module_outlook_invitation", $permanent_info);
                 }
                 if ($form->exportValue('submit_event_all')) {
                     $users = $course->getCourseUsers(array('active' => true, archive => false, 'return_objects' => false));
                     $recipients = array();
                     foreach ($users as $value) {
                         $recipients[] = $value['email'];
                     }
                     $this->sendInvitation($course->course['id'], $recipients);
                 }
                 //					$smarty->assign('T_RELOAD', true);
                 if (isset($_GET['popup'])) {
                     $this->setMessageVar(_OPERATIONCOMPLETEDSUCCESSFULLY, 'success');
                 } else {
                     eF_redirect($this->moduleBaseUrl . "&message=" . urlencode(_OPERATIONCOMPLETEDSUCCESSFULLY) . "&message_type=success");
                 }
             } catch (Exception $e) {
                 $smarty->assign("T_EXCEPTION_TRACE", $e->getTraceAsString());
                 $this->setMessageVar($e->getMessage() . ' (' . $e->getCode() . ') &nbsp;<a href = "javascript:void(0)" onclick = "eF_js_showDivPopup(event, \'' . _ERRORDETAILS . '\', 2, \'error_details\')">' . _MOREINFO . '</a>', 'failure');
             }
         }
         $form->setJsWarnings(_BEFOREJAVASCRIPTERROR, _AFTERJAVASCRIPTERROR);
         $form->setRequiredNote(_REQUIREDNOTE);
         $smarty->assign('T_MODULE_OUTLOOK_INVITATION_FORM', $form->toArray());
     }
     $smarty->assign("T_MODULE_BASEDIR", $this->moduleBaseDir);
     $smarty->assign("T_MODULE_BASELINK", $this->moduleBaseLink);
     $smarty->assign("T_MODULE_BASEURL", $this->moduleBaseUrl);
     return true;
 }
开发者ID:kaseya-university,项目名称:efront,代码行数:101,代码来源:module_outlook_invitation.class.php

示例15: copyScorm

 /**
  * Copy a simple scorm unit or test
  *
  * This function copies a scorm unit/test (NOT its children) into the current content tree
  * <br/>Example:
  * <code>
  * $currentContent = new EfrontContentTree(5);           //Initialize content for lesson with id 5
  * $currentContent -> copySimpleUnit(3, false);   //Copy the scorm unit with id = 3 into the content tree (at its end)
  * </code>
  *
  * @param int The id of the scorm unit/test (in the scorm_data table)
  * @param EfrontUnit $sourceUnit The unit object to be copied
  * @param mixed $targetUnit The id of the parent unit (or the parent EfrontUnit)in which the new unit will be copied, or false (the unit will be appended at the end)
  * @return EfrontUnit The newly created unit object
  * @since 3.5.0
  * @access public
  */
 public function copyScorm($sid, $sourceUnit, $targetUnit, $copyFiles = true)
 {
     $newUnit = $this->copySimpleUnit($sourceUnit, $targetUnit, false, $copyFiles);
     if ($sid) {
         $data = eF_getTableData("scorm_data", "*", "id = " . $sid);
         $scorm_array = $data[0];
         unset($scorm_array['id']);
         $scorm_array['content_ID'] = $newUnit->offsetGet('id');
         eF_insertTableData("scorm_data", $scorm_array);
     }
     return $newUnit;
 }
开发者ID:kaseya-university,项目名称:efront,代码行数:29,代码来源:content.class.php


注:本文中的eF_insertTableData函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。