<?php $access = new AccessData(); $access->query("ALTER TABLE " . StudyPressDB::getTableNameCourse() . " ADD " . StudyPressDB::COL_PICTURE_COURSE . " VARCHAR(255)"); $access->query("ALTER TABLE " . StudyPressDB::getTableNameActivity() . " ADD " . StudyPressDB::COL_ORDER_ACTIVITY . " INT NOT NULL"); $access->query("ALTER TABLE " . StudyPressDB::getTableNameActivity() . " CHANGE notes " . StudyPressDB::COL_TAGS_ACTIVITY . " longtext"); $access->query("ALTER TABLE " . StudyPressDB::getTableNameVisite() . " CHANGE lesson_id " . StudyPressDB::COL_ID_ACTIVITY_VISITE . " BIGINT UNSIGNED"); $access->query("ALTER TABLE " . StudyPressDB::getTableNameVisite() . " CHANGE user_visite " . StudyPressDB::COL_ID_USER_VISITE . " BIGINT UNSIGNED"); $access->query("ALTER TABLE " . StudyPressDB::getTableNameQuestions() . " CHANGE col " . StudyPressDB::COL_TYPE_QUESTION . " VARCHAR(25)"); $access->query("UPDATE " . StudyPressDB::getTableNameQuestions() . " SET " . StudyPressDB::COL_TYPE_QUESTION . " = 'multiple'"); $access->query("ALTER TABLE " . StudyPressDB::getTableNameActivity() . " CHANGE picture_url " . StudyPressDB::COL_PICTURE_ACTIVITY . " text"); $access->query("ALTER TABLE " . StudyPressDB::getTableNameActivity() . " CHANGE activity_id " . StudyPressDB::COL_ID_ACTIVITY . " BIGINT UNSIGNED AUTO_INCREMENT"); $access->query("ALTER TABLE " . StudyPressDB::getTableNameSlide() . " CHANGE slide_id " . StudyPressDB::COL_ID_SLIDE . " BIGINT UNSIGNED AUTO_INCREMENT"); $access->query("ALTER TABLE " . StudyPressDB::getTableName_CourseUsers() . " CHANGE ID " . StudyPressDB::COL_ID_USERS_USERS_N_COURSE . " BIGINT UNSIGNED"); $access->query("ALTER TABLE " . StudyPressDB::getTableNameVisite() . " CHANGE visite_id " . StudyPressDB::COL_ID_VISITE . " BIGINT UNSIGNED AUTO_INCREMENT"); $access->query("ALTER TABLE " . StudyPressDB::getTableNameDomain() . " CHANGE domain_id " . StudyPressDB::COL_ID_DOMAIN . " BIGINT UNSIGNED AUTO_INCREMENT"); $access->query("ALTER TABLE " . StudyPressDB::getTableNameRateQuality() . " CHANGE ID " . StudyPressDB::COL_ID_USER_RATE_QUALITY . " BIGINT UNSIGNED"); $access->query("ALTER TABLE " . StudyPressDB::getTableNameRateQuality() . " CHANGE rate_id " . StudyPressDB::COL_ID_RATE_QUALITY . " BIGINT UNSIGNED AUTO_INCREMENT"); $access->query("ALTER TABLE " . StudyPressDB::getTableNameRateDomain() . " CHANGE ID " . StudyPressDB::COL_ID_USER_RATE_DOMAIN . " BIGINT UNSIGNED"); $access->query("ALTER TABLE " . StudyPressDB::getTableNameRateDomain() . " CHANGE rate_domain_id " . StudyPressDB::COL_ID_RATE_DOMAIN . " BIGINT UNSIGNED AUTO_INCREMENT"); $access->query("ALTER TABLE " . StudyPressDB::getTableNameQuestions() . " CHANGE question_id " . StudyPressDB::COL_ID_QUESTION . " BIGINT UNSIGNED AUTO_INCREMENT"); $access->query("ALTER TABLE " . StudyPressDB::getTableNamePropositions() . " CHANGE proposition_id " . StudyPressDB::COL_ID_PROPOSITION . " BIGINT UNSIGNED AUTO_INCREMENT"); $access->query("ALTER TABLE " . StudyPressDB::getTableNameResultQuiz() . " CHANGE ID " . StudyPressDB::COL_ID_USER_RESULT . " BIGINT UNSIGNED"); $access->query("ALTER TABLE " . StudyPressDB::getTableNameResultQuiz() . " CHANGE result_id " . StudyPressDB::COL_ID_RESULT . " BIGINT UNSIGNED AUTO_INCREMENT"); $manager = new CourseManager(); $courses = $manager->getAll(); foreach ($courses as $course) { $manager->update($course->getId(), $course); }
function activate_studypress_plugin() { global $tr; $access = new AccessData(); $table = StudyPressDB::getTableNameCourse(); if ($access->getVar("SHOW TABLES LIKE '{$table}'") != $table) { $sql = "CREATE TABLE {$table} (\r\n " . StudyPressDB::COL_ID_COURSE . " BIGINT UNSIGNED AUTO_INCREMENT ,\r\n " . StudyPressDB::COL_NAME_COURSE . " VARCHAR(200),\r\n " . StudyPressDB::COL_DESCRIPTION_COURSE . " LONGTEXT ,\r\n " . StudyPressDB::COL_AVANCEMENT_COURSE . " VARCHAR(255) DEFAULT '0',\r\n " . StudyPressDB::COL_PICTURE_COURSE . " VARCHAR(255),\r\n " . StudyPressDB::COL_ID_POST_COURSE . " BIGINT DEFAULT NULL,\r\n PRIMARY KEY (" . StudyPressDB::COL_ID_COURSE . ")\r\n )"; $access->query($sql); } $table = StudyPressDB::getTableNameActivity(); if ($access->getVar("SHOW TABLES LIKE '{$table}'") != $table) { $sql = "CREATE TABLE {$table} (\r\n " . StudyPressDB::COL_ID_ACTIVITY . " BIGINT UNSIGNED AUTO_INCREMENT ,\r\n " . StudyPressDB::COL_ID_COURSE_ACTIVITY . " BIGINT UNSIGNED ,\r\n " . StudyPressDB::COL_NAME_ACTIVITY . " VARCHAR(200),\r\n " . StudyPressDB::COL_DURATION_ACTIVITY . " INT NOT NULL,\r\n " . StudyPressDB::COL_AUTEUR_ACTIVITY . " VARCHAR(200),\r\n " . StudyPressDB::COL_DESCRIPTION_ACTIVITY . " longtext ,\r\n " . StudyPressDB::COL_TAGS_ACTIVITY . " longtext ,\r\n " . StudyPressDB::COL_GLOSSARY_ACTIVITY . " longtext ,\r\n " . StudyPressDB::COL_PICTURE_ACTIVITY . " text,\r\n " . StudyPressDB::COL_SHORT_CODE_ACTIVITY . " VARCHAR(50),\r\n " . StudyPressDB::COL_ID_AUTEUR_ACTIVITY . " BIGINT,\r\n " . StudyPressDB::COL_ID_POST_ACTIVITY . " BIGINT DEFAULT NULL,\r\n " . StudyPressDB::COL_TYPE_ACTIVITY . " VARCHAR(10),\r\n " . StudyPressDB::COL_ORDER_ACTIVITY . " INT NOT NULL,\r\n PRIMARY KEY (" . StudyPressDB::COL_ID_ACTIVITY . "),\r\n FOREIGN KEY (" . StudyPressDB::COL_ID_COURSE_ACTIVITY . ") REFERENCES " . StudyPressDB::getTableNameCourse() . " (" . StudyPressDB::COL_ID_COURSE . ")\r\n )"; $access->query($sql); } $table = StudyPressDB::getTableNameSlide(); if ($access->getVar("SHOW TABLES LIKE '{$table}'") != $table) { $sql = "CREATE TABLE {$table} (\r\n " . StudyPressDB::COL_ID_SLIDE . " BIGINT UNSIGNED AUTO_INCREMENT ,\r\n " . StudyPressDB::COL_ID_LESSON_SLIDE . " BIGINT UNSIGNED,\r\n " . StudyPressDB::COL_NAME_SLIDE . " VARCHAR(200) ,\r\n " . StudyPressDB::COL_CONTENT_SLIDE . " longtext ,\r\n " . StudyPressDB::COL_ORDER_SLIDE . " INT NOT NULL,\r\n PRIMARY KEY (" . StudyPressDB::COL_ID_SLIDE . "),\r\n FOREIGN KEY (" . StudyPressDB::COL_ID_LESSON_SLIDE . ") REFERENCES " . StudyPressDB::getTableNameActivity() . " (" . StudyPressDB::COL_ID_ACTIVITY . ")\r\n )"; $access->query($sql); } $table = StudyPressDB::getTableName_CourseCategory(); if ($access->getVar("SHOW TABLES LIKE '{$table}'") != $table) { $sql = "CREATE TABLE {$table} (\r\n " . StudyPressDB::COL_ID_COURSE_CAT_N_COURSE . " BIGINT UNSIGNED,\r\n " . StudyPressDB::COL_ID_CATEGORY_CAT_N_COURSE . " BIGINT UNSIGNED,\r\n PRIMARY KEY (" . StudyPressDB::COL_ID_COURSE_CAT_N_COURSE . "," . StudyPressDB::COL_ID_CATEGORY_CAT_N_COURSE . "),\r\n FOREIGN KEY (" . StudyPressDB::COL_ID_CATEGORY_CAT_N_COURSE . ") REFERENCES\r\n " . StudyPressDB::getTableNameCategoryWP() . " (" . StudyPressDB::COL_ID_CATEGORY_WP . "),\r\n FOREIGN KEY (" . StudyPressDB::COL_ID_COURSE_CAT_N_COURSE . ") REFERENCES\r\n " . StudyPressDB::getTableNameCourse() . " (" . StudyPressDB::COL_ID_COURSE . ")\r\n )"; $access->query($sql); } $table = StudyPressDB::getTableName_CourseUsers(); if ($access->getVar("SHOW TABLES LIKE '{$table}'") != $table) { $sql = "CREATE TABLE {$table} (\r\n " . StudyPressDB::COL_ID_COURSE_CAT_N_COURSE . " BIGINT UNSIGNED,\r\n " . StudyPressDB::COL_ID_USERS_USERS_N_COURSE . " BIGINT UNSIGNED,\r\n PRIMARY KEY (" . StudyPressDB::COL_ID_COURSE_ACTIVITY . "," . StudyPressDB::COL_ID_USERS_USERS_N_COURSE . "),\r\n FOREIGN KEY (" . StudyPressDB::COL_ID_USERS_USERS_N_COURSE . ") REFERENCES\r\n " . StudyPressDB::getTableNameUsersWP() . " (" . StudyPressDB::COL_ID_USER_WP . "),\r\n FOREIGN KEY (" . StudyPressDB::COL_ID_COURSE_CAT_N_COURSE . ") REFERENCES\r\n " . StudyPressDB::getTableNameCourse() . " (" . StudyPressDB::COL_ID_COURSE . ")\r\n )"; $access->query($sql); } $table = StudyPressDB::getTableNameVisite(); if ($access->getVar("SHOW TABLES LIKE '{$table}'") != $table) { $sql = "CREATE TABLE {$table} (\r\n " . StudyPressDB::COL_ID_VISITE . " BIGINT UNSIGNED AUTO_INCREMENT,\r\n \t\t\t\t\t" . StudyPressDB::COL_ID_ACTIVITY_VISITE . " BIGINT UNSIGNED,\r\n \t\t\t\t\t" . StudyPressDB::COL_IP_VISITE . " VARCHAR(40),\r\n \t\t\t\t\t" . StudyPressDB::COL_DATE_VISITE . " DATETIME,\r\n\t\t\t\t\t" . StudyPressDB::COL_ID_USER_VISITE . " BIGINT UNSIGNED ,\r\n \t\t\t\t\t PRIMARY KEY (" . StudyPressDB::COL_ID_VISITE . "),\r\n\t\t\t\t\t FOREIGN KEY ( " . StudyPressDB::COL_ID_ACTIVITY_VISITE . " ) REFERENCES " . StudyPressDB::getTableNameActivity() . " (" . StudyPressDB::COL_ID_ACTIVITY . "),\r\n\t\t\t\t\t FOREIGN KEY ( " . StudyPressDB::COL_ID_USER_VISITE . " ) REFERENCES " . StudyPressDB::getTableNameUsersWP() . " (" . StudyPressDB::COL_ID_USER_WP . ")\r\n\t\t\t\t\t )"; $access->query($sql); } $table = StudyPressDB::getTableNameDomain(); if ($access->getVar("SHOW TABLES LIKE '{$table}'") != $table) { $sql = "CREATE TABLE {$table} (\r\n " . StudyPressDB::COL_ID_DOMAIN . " BIGINT UNSIGNED AUTO_INCREMENT,\r\n " . StudyPressDB::COL_NAME_DOMAIN . " VARCHAR(200) UNIQUE,\r\n \t\t\t\t\t" . StudyPressDB::COL_DESCRIPTION_DOMAIN . " LONGTEXT,\r\n \t\t\t\t\tPRIMARY KEY (" . StudyPressDB::COL_ID_DOMAIN . ")\r\n\t\t\t\t\t )"; $access->query($sql); } $table = StudyPressDB::getTableNameRateQuality(); if ($access->getVar("SHOW TABLES LIKE '{$table}'") != $table) { $sql = "CREATE TABLE {$table} (\r\n " . StudyPressDB::COL_ID_RATE_QUALITY . " BIGINT UNSIGNED AUTO_INCREMENT,\r\n \t\t\t\t\t" . StudyPressDB::COL_ID_ACTIVITY_RATE_QUALITY . " BIGINT UNSIGNED ,\r\n \t\t\t\t\t" . StudyPressDB::COL_VALUE_RATE_QUALITY . " INT NULL,\r\n \t\t\t\t\t" . StudyPressDB::COL_DATE_RATE_QUALITY . " DATETIME,\r\n\t\t\t\t\t" . StudyPressDB::COL_ID_USER_RATE_QUALITY . " BIGINT UNSIGNED,\r\n\t\t\t\t\t" . StudyPressDB::COL_IP_RATE_QUALITY . " INT UNSIGNED,\r\n \t\t\t\t\t PRIMARY KEY (" . StudyPressDB::COL_ID_RATE_QUALITY . "),\r\n \t\t\t\t\t FOREIGN KEY ( " . StudyPressDB::COL_ID_ACTIVITY_RATE_QUALITY . " ) REFERENCES " . StudyPressDB::getTableNameActivity() . " (" . StudyPressDB::COL_ID_ACTIVITY . "),\r\n\t\t\t\t\t FOREIGN KEY ( " . StudyPressDB::COL_ID_USER_RATE_QUALITY . " ) REFERENCES " . StudyPressDB::getTableNameUsersWP() . " (" . StudyPressDB::COL_ID_USER_WP . ")\r\n\t\t\t\t\t )"; $access->query($sql); } $table = StudyPressDB::getTableNameRateDomain(); if ($access->getVar("SHOW TABLES LIKE '{$table}'") != $table) { $sql = "CREATE TABLE {$table} (\r\n " . StudyPressDB::COL_ID_RATE_DOMAIN . " BIGINT UNSIGNED AUTO_INCREMENT,\r\n \t\t\t\t\t" . StudyPressDB::COL_ID_ACTIVITY_RATE_DOMAIN . " BIGINT UNSIGNED ,\r\n \t\t\t\t\t" . StudyPressDB::COL_VALUE_RATE_DOMAIN . " INT NULL,\r\n \t\t\t\t\t" . StudyPressDB::COL_DATE_RATE_DOMAIN . " DATETIME,\r\n\t\t\t\t\t" . StudyPressDB::COL_ID_USER_RATE_DOMAIN . " BIGINT UNSIGNED,\r\n\t\t\t\t\t" . StudyPressDB::COL_ID_DOMAIN_RATE_DOMAIN . " BIGINT UNSIGNED,\r\n\t\t\t\t\t" . StudyPressDB::COL_IP_RATE_DOMAIN . " INT UNSIGNED,\r\n \t\t\t\t\t PRIMARY KEY (" . StudyPressDB::COL_ID_RATE_DOMAIN . "),\r\n\t\t\t\t\t UNIQUE ( " . StudyPressDB::COL_ID_ACTIVITY_RATE_DOMAIN . "," . StudyPressDB::COL_ID_DOMAIN_RATE_DOMAIN . "," . StudyPressDB::COL_ID_USER_RATE_DOMAIN . " ),\r\n\t\t\t\t\t FOREIGN KEY ( " . StudyPressDB::COL_ID_ACTIVITY_RATE_QUALITY . " ) REFERENCES " . StudyPressDB::getTableNameActivity() . " (" . StudyPressDB::COL_ID_ACTIVITY . "),\r\n\t\t\t\t\t FOREIGN KEY ( " . StudyPressDB::COL_ID_USER_RATE_QUALITY . " ) REFERENCES " . StudyPressDB::getTableNameUsersWP() . " (" . StudyPressDB::COL_ID_USER_WP . "),\r\n\t\t\t\t\t FOREIGN KEY ( " . StudyPressDB::COL_ID_DOMAIN_RATE_DOMAIN . " ) REFERENCES " . StudyPressDB::getTableNameDomain() . " (" . StudyPressDB::COL_ID_DOMAIN . ")\r\n\t\t\t\t\t )"; $access->query($sql); } $table = StudyPressDB::getTableNameQuestions(); if ($access->getVar("SHOW TABLES LIKE '{$table}'") != $table) { $sql = "CREATE TABLE {$table} (\r\n " . StudyPressDB::COL_ID_QUESTION . " BIGINT UNSIGNED AUTO_INCREMENT ,\r\n " . StudyPressDB::COL_ID_QUIZ_QUESTION . " BIGINT UNSIGNED,\r\n " . StudyPressDB::COL_CONTENT_QUESTION . " TEXT,\r\n " . StudyPressDB::COL_ORDER_QUESTION . " INT NOT NULL,\r\n " . StudyPressDB::COL_TYPE_QUESTION . " VARCHAR(25) ,\r\n PRIMARY KEY (" . StudyPressDB::COL_ID_QUESTION . "),\r\n FOREIGN KEY (" . StudyPressDB::COL_ID_QUIZ_QUESTION . ") REFERENCES " . StudyPressDB::getTableNameActivity() . " (" . StudyPressDB::COL_ID_ACTIVITY . ")\r\n )"; $access->query($sql); } $table = StudyPressDB::getTableNamePropositions(); if ($access->getVar("SHOW TABLES LIKE '{$table}'") != $table) { $sql = "CREATE TABLE {$table} (\r\n " . StudyPressDB::COL_ID_PROPOSITION . " BIGINT UNSIGNED AUTO_INCREMENT ,\r\n " . StudyPressDB::COL_ID_QUESTION_PROPOSITION . " BIGINT UNSIGNED,\r\n " . StudyPressDB::COL_CONTENT_PROPOSITION . " TEXT ,\r\n " . StudyPressDB::COL_TYPE_PROPOSITION . " VARCHAR(10),\r\n " . StudyPressDB::COL_ORDER_PROPOSITION . " INT NOT NULL,\r\n " . StudyPressDB::COL_COL_PROPOSITION . " VARCHAR(255) ,\r\n PRIMARY KEY (" . StudyPressDB::COL_ID_PROPOSITION . "),\r\n FOREIGN KEY (" . StudyPressDB::COL_ID_QUESTION_PROPOSITION . ") REFERENCES " . StudyPressDB::getTableNameQuestions() . " (" . StudyPressDB::COL_ID_QUESTION . ")\r\n )"; $access->query($sql); } $table = StudyPressDB::getTableNameResultQuiz(); if ($access->getVar("SHOW TABLES LIKE '{$table}'") != $table) { $sql = "CREATE TABLE {$table} (\r\n " . StudyPressDB::COL_ID_RESULT . " BIGINT UNSIGNED AUTO_INCREMENT ,\r\n " . StudyPressDB::COL_ID_QUIZ_RESULT . " BIGINT UNSIGNED,\r\n " . StudyPressDB::COL_ID_USER_RESULT . " BIGINT UNSIGNED,\r\n " . StudyPressDB::COL_DATE_RESULT . " DATETIME,\r\n " . StudyPressDB::COL_RESPONSE_RESULT . " LONGTEXT,\r\n " . StudyPressDB::COL_NOTE_RESULT . " INT,\r\n " . StudyPressDB::COL_NBR_QUESTIONS_RESULT . " INT,\r\n " . StudyPressDB::COL_NBR_CORRECTS_RESULT . " INT,\r\n " . StudyPressDB::COL_DATE_BEGIN_RESULT . " VARCHAR(30),\r\n " . StudyPressDB::COL_VALIDATE_RESULT . " VARCHAR(6),\r\n PRIMARY KEY (" . StudyPressDB::COL_ID_RESULT . "),\r\n UNIQUE (" . StudyPressDB::COL_ID_QUIZ_RESULT . "," . StudyPressDB::COL_ID_USER_RESULT . "),\r\n FOREIGN KEY (" . StudyPressDB::COL_ID_QUIZ_RESULT . ") REFERENCES " . StudyPressDB::getTableNameActivity() . " (" . StudyPressDB::COL_ID_ACTIVITY . ")\r\n )"; $access->query($sql); } $table = StudyPressDB::getTableNameConfiguration(); if ($access->getVar("SHOW TABLES LIKE '{$table}'") != $table) { $sql = "CREATE TABLE {$table} (\r\n " . StudyPressDB::COL_ID_CONFIG . " BIGINT UNSIGNED AUTO_INCREMENT ,\r\n " . StudyPressDB::COL_NAME_CONFIG . " VARCHAR(200),\r\n " . StudyPressDB::COL_VALUE_CONFIG . " VARCHAR(10),\r\n PRIMARY KEY (" . StudyPressDB::COL_ID_CONFIG . ")\r\n )"; $access->query($sql); } $table = StudyPressDB::getTableName_GroupCourse(); if ($access->getVar("SHOW TABLES LIKE '{$table}'") != $table) { $sql = "CREATE TABLE {$table} (\r\n " . StudyPressDB::COL_ID_GROUP . " BIGINT UNSIGNED AUTO_INCREMENT,\r\n " . StudyPressDB::COL_ID_COURSE_GROUP . " BIGINT UNSIGNED,\r\n " . StudyPressDB::COL_ID_GROUP_BP . " BIGINT UNSIGNED,\r\n UNIQUE (" . StudyPressDB::COL_ID_GROUP_BP . "," . StudyPressDB::COL_ID_COURSE_GROUP . "),\r\n PRIMARY KEY (" . StudyPressDB::COL_ID_GROUP . "),\r\n FOREIGN KEY (" . StudyPressDB::COL_ID_COURSE_GROUP . ") REFERENCES\r\n " . StudyPressDB::getTableNameCourse() . " (" . StudyPressDB::COL_ID_COURSE . ")\r\n )"; $access->query($sql); } require_once 'Migration/v0.12tov1.0.php'; $nbrColumnOfCourse = $access->getResults("DESC " . StudyPressDB::getTableNameCourse()); if (count($nbrColumnOfCourse) < 6) { require_once 'Migration/1.0-to-1.1.php'; } require_once 'notices.php'; add_menu_page('Cours', 'studypress', 'publish_posts', 'id_Cours', 'display_courses', __ROOT_PLUGIN__2 . 'images/logo.png', '30'); add_submenu_page('id_Cours', $tr->__("Lessons"), $tr->__("Lessons"), 'publish_posts', 'id_Cours', 'display_courses'); function display_courses() { require_once __ROOT_PLUGIN__ . 'controllers/lesson.controller.php'; } add_submenu_page('id_Cours', 'Quizs', 'Quizs', 'publish_posts', 'quizs', 'display_quizs'); function display_quizs() { require_once __ROOT_PLUGIN__ . 'controllers/quiz.controller.php'; } add_submenu_page(null, 'Modifier Quiz', 'Modifier Quiz', 'publish_posts', 'mod-quiz', 'display_mod_quiz'); function display_mod_quiz() { require_once __ROOT_PLUGIN__ . 'controllers/modQuiz.controller.php'; } add_submenu_page(null, 'Result Quiz', 'Result Quiz', 'publish_posts', 'result-quiz', 'display_result_quiz'); function display_result_quiz() { require_once __ROOT_PLUGIN__ . 'controllers/resultQuiz.controller.php'; } add_submenu_page('id_Cours', $tr->__('Courses'), $tr->__('Courses'), 'publish_posts', 'courses', 'display_categories'); function display_categories() { require_once __ROOT_PLUGIN__ . 'controllers/course.controller.php'; } add_submenu_page(null, 'Modifier Cours', 'Modifier Cours', 'publish_posts', 'mod-course', 'display_mod_course'); function display_mod_course() { require_once __ROOT_PLUGIN__ . 'controllers/modCourse.controller.php'; } add_submenu_page(null, 'Modifier Leçon', 'Modifier Leçon', 'publish_posts', 'mod-lesson', 'display_mod_lesson'); function display_mod_lesson() { require_once __ROOT_PLUGIN__ . 'controllers/modLesson.controller.php'; } add_submenu_page('id_Cours', $tr->__('Parameters'), $tr->__('Parameters'), 'manage_options', 'sp_parameters', 'display_parameters'); function display_parameters() { require_once __ROOT_PLUGIN__ . 'controllers/configuration.controller.php'; } add_submenu_page('id_Cours', $tr->__('Help'), $tr->__('Help'), 'publish_posts', 'sp_help', 'display_help'); function display_help() { require_once __ROOT_PLUGIN__ . 'Views/admin/help.view.php'; } }
public function updateOrders(array $idQuestionOrder) { $ids = implode(',', array_keys($idQuestionOrder)); $sql = "UPDATE " . StudyPressDB::getTableNameQuestions() . " SET " . StudyPressDB::COL_ORDER_QUESTION . " = CASE " . StudyPressDB::COL_ID_QUESTION . " "; foreach ($idQuestionOrder as $id => $ordinal) { $sql .= sprintf("WHEN %d THEN %d ", $id, $ordinal); } $sql .= "END WHERE " . StudyPressDB::COL_ID_QUESTION . " IN ({$ids})"; $this->_access->query($sql); }