/** * Toma el valor para el idioma. * @param optional string $lang The language abbriviation. * * @access public * */ function setLang($lang = null) { include_once Util::base_Path('include/classes/nls.inc.php'); //Debug::oneVar($lang, __FILE__, __LINE__); if (empty($lang) || !NLS::isValid($lang)) { if (Session::getValue('lang') != null) { $lang = Session::getValue('lang'); } else { if (Session::getContextValue('gettext_lang') != null) { $lang = Session::getContextValue('gettext_lang'); } else { $lang = 'es_ES'; } } } Session::setValue('language', $lang); //Debug::oneVar($lang, __FILE__, __LINE__); /* First try language with the current charset. */ $lang_charset = $lang . '.' . NLS::getCharset(); if ($lang_charset != setlocale(LC_ALL, $lang_charset)) { /* Next try language with its default charset. */ global $nls; $charset = !empty($nls['charsets'][$lang]) ? $nls['charsets'][$lang] : $nls['defaults']['charset']; $lang_charset = $lang . '.' . $charset; NLS::_cachedCharset(0, $charset); if ($lang_charset != setlocale(LC_ALL, $lang_charset)) { /* At last try language solely. */ $lang_charset = $lang; setlocale(LC_ALL, $lang_charset); } } @putenv('LANG=' . $lang_charset); @putenv('LANGUAGE=' . $lang_charset); }
function getAllLang() { include_once Util::base_Path('include/classes/nls.class.php'); $langlist = array(); $dir = opendir(MIGUELGETTEXT_DIR); while ($item = readdir($dir)) { if ($item != '.' && $item != '..' && $item != 'CVS' && !is_file($item)) { $langlist[NLS::getLangLabel($item)] = $item; } } closedir($dir); return $langlist; }
function processPetition() { //Se controla que el usuario no tenga acceso. $bol_hasaccess = false; //Primero comprueba si estamos identificados y si no es asi entonces vamos a ver si es una peticion de autenticacion $user_id = $this->getSessionElement('userinfo', 'user_id'); if (isset($user_id) && $user_id != '') { $bol_hasaccess = true; $user = $this->getSessionElement('userinfo', 'user_alias'); } else { } if ($bol_hasaccess) { if ($user == 'guest') { //Error, el usuario no puede ser el invitado } else { //Realiza la inscripciÛn en el curso $course_id = $this->getViewVariable('course_id'); $this->_unsubscribeCourse($user_id, $course_id); $this->addNavElement(Util::format_URLPath('main/index.php'), agt('miguel_Courses')); $course_name = $this->obj_data->getCourseName($course_id); $this->setViewVariable('course_name', $course_name); //Realiza la notificacion si esta permitido if ($this->getSessionElement('userinfo', 'notify_email')) { include_once Util::base_Path("include/classes/mailer.class.php"); $mail = new miguel_mailer(); $mail->From = $this->getSessionElement('userinfo', 'email'); $mail->FromName = $this->getSessionElement('userinfo', 'name') . ' ' . $this->getSessionElement('userinfo', 'surname'); $mail->AddAddress($this->getSessionElement('userinfo', 'email'), $this->getSessionElement('userinfo', 'name')); $mail->AddReplyTo($this->getSessionElement('userinfo', 'email'), $this->getSessionElement('userinfo', 'name')); $mail->Subject = agt('miguel_newCourseUnsubscriptionSubject') . ' ' . $course_name; $mail->Body = agt('miguel_newCourseUnsubscriptionBody'); if (!$mail->Send()) { echo "Message could not be sent. <p>"; echo "Mailer Error: " . $mail->ErrorInfo; exit; } } $this->setCacheFile("miguel_VUnsubscribe_" . $this->getSessionElement("userinfo", "user_id")); $this->setMessage(agt("miguel_userUnsubscribe")); $this->setPageTitle("miguel_userUnsubscribe"); } } else { //Bienvenida } $this->setCacheFlag(true); $this->setHelp("EducContent"); }
/** * Constructor. * */ function Session() { //Parametros de tratamiento de errores ini_set('display_errors', 'On'); //ini_set('display_startup_errors', 'Off'); ini_set('log_errors', 'Off'); include_once Util::base_Path('include/classes/errorhandler.class.php'); $error_handler = new errorHandler(); $str_name = session_name(); if ($str_name != 'MIGUEL_BASE') { session_name('MIGUEL_BASE'); } //Parametros de sesion ini_set('session.save_handler', 'files'); ini_set('session.use_cookies', 0); if (MIGUELBASE_SESSION_DIR != '') { ini_set('session.save_path', MIGUELBASE_SESSION_DIR); } if (MIGUELBASE_PHP_INT_VERSION >= 40200) { session_cache_expire(MIGUELBASE_SESSION_TIME); } ini_set('session.use_trans_sid', 0); ini_set('session.gc_probability', 100); //Parametros para transferencia de ficheros ini_set('file_uploads', 'On'); ini_set('upload_tmp_dir', MIGUELBASE_CACHE_DIR); ini_set('upload_max_filesize', '2M'); if (!session_id()) { session_start(); } //Cargamos los valores de contexto if ($this->_isContextSet()) { $this->bol_okConfFile = true; } else { $this->_initContext(); $this->setValue('session', true); } }
function processPetition() { //Declaraciones comunes $virtual_user = array('username' => 'installer', 'name' => 'instalación', 'surname' => ''); $message = ''; $this->setSessionArray("userinfo", $virtual_user); //Paso en la instalación $install_step = intval($this->getSessionElement('install_step')); //Control de salida por peticion de usuario if ($this->issetViewVariable('quit')) { $install_step = -1; } switch ($install_step) { case -1: $this->currentStep = 0; break; case 1: include_once Util::base_Path('include/classes/nls.class.php'); NLS::setLang($this->getViewVariable('miguel_lang')); //NLS::setTextdomain('install', Util::formatPath(MIGUELGETTEXT_DIR), NLS::getCharset()); if ($this->issetViewVariable('submit')) { $this->currentStep = 2; } break; case 2: if ($this->issetViewVariable('submit')) { $this->currentStep = 3; } if ($this->issetViewVariable('back')) { $this->currentStep = 1; } break; case 3: if ($this->issetViewVariable('submit')) { $this->currentStep = 4; } if ($this->issetViewVariable('back')) { $this->currentStep = 2; } break; case 4: if ($this->issetViewVariable('submit')) { $all_Ok = false; //Control sobre variables de vista definidas if ($this->issetViewVariable('miguel_ddbb_sgbd') && $this->getViewVariable('miguel_ddbb_sgbd') != '') { $this->setViewVariable('inst_ddbb_sgbd', $this->getViewVariable('miguel_ddbb_sgbd')); $all_Ok = true; } else { $all_Ok = false; } if ($this->issetViewVariable('miguel_ddbb_host') && $this->getViewVariable('miguel_ddbb_host') != '') { $this->setViewVariable('inst_ddbb_host', $this->getViewVariable('miguel_ddbb_host')); $all_Ok = true; } else { $all_Ok = false; } if ($this->issetViewVariable('miguel_ddbb_name') && $this->getViewVariable('miguel_ddbb_name') != '') { $this->setViewVariable('inst_ddbb_name', $this->getViewVariable('miguel_ddbb_name')); $all_Ok = true; } else { $all_Ok = false; } if ($this->issetViewVariable('miguel_ddbb_user') && $this->getViewVariable('miguel_ddbb_user') != '') { $this->setViewVariable('inst_ddbb_user', $this->getViewVariable('miguel_ddbb_user')); $all_Ok = true; } else { $all_Ok = false; } if ($this->issetViewVariable('miguel_ddbb_passwd') && $this->getViewVariable('miguel_ddbb_passwd') != '') { $this->setViewVariable('inst_ddbb_passwd', $this->getViewVariable('miguel_ddbb_passwd')); $all_Ok = true; } else { $all_Ok = false; } if ($this->issetViewVariable('miguel_ddbb_passwd2') && $this->getViewVariable('miguel_ddbb_passwd2') != '') { $this->setViewVariable('inst_ddbb_passwd2', $this->getViewVariable('miguel_ddbb_passwd2')); $all_Ok = true; } else { $all_Ok = false; } if ($all_Ok) { if ($this->getViewVariable('miguel_ddbb_passwd') == $this->getViewVariable('miguel_ddbb_passwd2')) { $this->setSessionElement('host_sgbd', $this->getViewVariable('miguel_ddbb_sgbd')); $this->setSessionElement('host_name', $this->getViewVariable('miguel_ddbb_host')); $this->setSessionElement('ddbb_name', $this->getViewVariable('miguel_ddbb_name')); $this->setSessionElement('ddbb_user', $this->getViewVariable('miguel_ddbb_user')); $this->setSessionElement('ddbb_passwd', $this->getViewVariable('miguel_ddbb_passwd')); $this->currentStep = 5; } else { $this->currentStep = 4; $message = 'Error: Las claves no coinciden.'; } } else { $this->currentStep = 4; $message = 'Error: Todos los campos son obligatorios.'; } } if ($this->issetViewVariable('back')) { $this->currentStep = 3; } break; case 5: if ($this->issetViewVariable('submit')) { $all_Ok = false; if ($this->issetViewVariable('miguel_campus_name') && $this->getViewVariable('miguel_campus_name') != '') { $this->setViewVariable('inst_campus_name', $this->getViewVariable('miguel_campus_name')); $all_Ok = true; } else { $all_Ok = false; } if ($this->issetViewVariable('miguel_inst_name') && $this->getViewVariable('miguel_inst_name') != '') { $this->setViewVariable('inst_inst_name', $this->getViewVariable('miguel_inst_name')); $all_Ok = true; } else { $all_Ok = false; } if ($this->issetViewVariable('miguel_inst_url') && $this->getViewVariable('miguel_inst_url') != '') { $this->setViewVariable('inst_inst_url', $this->getViewVariable('miguel_inst_url')); $all_Ok = true; } else { $all_Ok = false; } if ($this->issetViewVariable('miguel_director_name') && $this->getViewVariable('miguel_director_name') != '') { $this->setViewVariable('inst_director_name', $this->getViewVariable('miguel_director_name')); $all_Ok = true; } else { $all_Ok = false; } if ($this->issetViewVariable('miguel_director_email') && $this->getViewVariable('miguel_director_email') != '') { $this->setViewVariable('inst_director_email', $this->getViewVariable('miguel_director_email')); $all_Ok = true; } else { $all_Ok = false; } if ($this->issetViewVariable('miguel_inst_phone') && $this->getViewVariable('miguel_inst_phone') != '') { $this->setViewVariable('inst_inst_phone', $this->getViewVariable('miguel_inst_phone')); $all_Ok = true; } else { $all_Ok = false; } if ($this->issetViewVariable('miguel_campus_lang') && $this->getViewVariable('miguel_campus_lang') != '') { $this->setViewVariable('inst_campus_lang', $this->getViewVariable('miguel_campus_lang')); $all_Ok = true; } else { $all_Ok = false; } if ($this->issetViewVariable('miguel_campus_lang') && $this->getViewVariable('miguel_campus_lang') != '') { $this->setViewVariable('inst_campus_lang', $this->getViewVariable('miguel_campus_lang')); $all_Ok = true; } else { $all_Ok = false; } if ($this->issetViewVariable('miguel_admin_name') && $this->getViewVariable('miguel_admin_name') != '') { $this->setViewVariable('inst_admin_name', $this->getViewVariable('miguel_admin_name')); $all_Ok = true; } else { $all_Ok = false; } if ($this->issetViewVariable('miguel_admin_surname') && $this->getViewVariable('miguel_admin_surname') != '') { $this->setViewVariable('inst_admin_surname', $this->getViewVariable('miguel_admin_surname')); $all_Ok = true; } else { $all_Ok = false; } if ($this->issetViewVariable('miguel_admin_user') && $this->getViewVariable('miguel_admin_user') != '') { $this->setViewVariable('inst_admin_user', $this->getViewVariable('miguel_admin_user')); $all_Ok = true; } else { $all_Ok = false; } if ($this->issetViewVariable('miguel_admin_passwd') && $this->getViewVariable('miguel_admin_passwd') != '') { $this->setViewVariable('inst_admin_passwd', $this->getViewVariable('miguel_admin_passwd')); $all_Ok = true; } else { $all_Ok = false; } if ($this->issetViewVariable('miguel_admin_passwd2') && $this->getViewVariable('miguel_admin_passwd2') != '') { $this->setViewVariable('inst_admin_passwd2', $this->getViewVariable('miguel_admin_passwd2')); $all_Ok = true; } else { $all_Ok = false; } if ($this->issetViewVariable('miguel_admin_theme') && $this->getViewVariable('miguel_admin_theme') != '') { $this->setViewVariable('inst_admin_theme', $this->getViewVariable('miguel_admin_theme')); $all_Ok = true; } else { $all_Ok = false; } if ($this->issetViewVariable('miguel_cript_passwd') && $this->getViewVariable('miguel_cript_passwd') != '') { $this->setViewVariable('inst_cript_passwd', $this->getViewVariable('miguel_cript_passwd')); $all_Ok = true; } else { $all_Ok = false; } if ($all_Ok) { if ($this->getViewVariable('miguel_admin_passwd') == $this->getViewVariable('miguel_admin_passwd2')) { $this->setSessionElement('campus_name', $this->getViewVariable('miguel_campus_name')); $this->setSessionElement('inst_name', $this->getViewVariable('miguel_inst_name')); $this->setSessionElement('inst_url', $this->getViewVariable('miguel_inst_url')); $this->setSessionElement('director_name', $this->getViewVariable('miguel_director_name')); $this->setSessionElement('director_email', $this->getViewVariable('miguel_director_email')); $this->setSessionElement('inst_phone', $this->getViewVariable('miguel_inst_phone')); $this->setSessionElement('campus_lang', $this->getViewVariable('miguel_campus_lang')); $this->setSessionElement('admin_name', $this->getViewVariable('miguel_admin_name')); $this->setSessionElement('admin_surname', $this->getViewVariable('miguel_admin_surname')); $this->setSessionElement('admin_user', $this->getViewVariable('miguel_admin_user')); $this->setSessionElement('admin_passwd', $this->getViewVariable('miguel_admin_passwd')); $this->setSessionElement('admin_theme', $this->getViewVariable('miguel_admin_theme')); if ($this->getViewVariable('miguel_cript_passwd') == agt('Si')) { $cripted = 'true'; } else { $cripted = 'false'; } $this->setSessionElement('cript_passwd', $cripted); $this->currentStep = 6; } else { $this->currentStep = 5; $message = 'Error: Las claves no coinciden.'; } } else { $this->currentStep = 5; $message = 'Error: Todos los campos son obligatorios.'; } } if ($this->issetViewVariable('back')) { $this->currentStep = 4; } break; case 6: if ($this->issetViewVariable('submit')) { $this->obj_data->makeXMLData(); $this->currentStep = 7; } if ($this->issetViewVariable('back')) { $this->currentStep = 5; } break; default: $this->currentStep = 1; } //end switch switch ($this->currentStep) { case 0: //$this->Close(); $this->setViewVariable("install_step", 0); break; case 1: if (!$this->issetViewVariable('inst_lang')) { $this->setViewVariable('inst_lang', NLS::getLangLabel('es_ES')); } $this->setViewVariable('select_lang', $this->obj_data->getAllLang()); $this->setViewVariable("install_step", 1); break; case 2: $this->setViewVariable("install_step", 2); $this->setViewVariable("install_require", $this->_getRequire()); break; case 3: $this->setViewVariable("install_step", 3); break; case 4: if (!$this->issetViewVariable('inst_ddbb_sgbd')) { $this->setViewVariable('inst_ddbb_sgbd', $this->obj_data->getAllSGBD()); } if (!$this->issetViewVariable('inst_ddbb_host')) { $this->setViewVariable('inst_ddbb_host', 'localhost'); } if (!$this->issetViewVariable('inst_ddbb_name')) { $this->setViewVariable('inst_ddbb_name', 'miguel'); } if (!$this->issetViewVariable('inst_ddbb_user')) { $this->setViewVariable('inst_ddbb_user', 'root'); } if (!$this->issetViewVariable('inst_ddbb_passwd')) { $this->setViewVariable('inst_ddbb_passwd', Util::newPasswd()); } if (!$this->issetViewVariable('inst_ddbb_paswwd2')) { $this->setViewVariable('inst_ddbb_paswwd2', ''); } $this->setViewVariable("install_step", 4); break; case 5: if (!$this->issetViewVariable('inst_campus_name')) { $this->setViewVariable('inst_campus_name', 'miguel (OO)'); } if (!$this->issetViewVariable('inst_inst_name')) { $this->setViewVariable('inst_inst_name', 'Hispalinux'); } if (!$this->issetViewVariable('inst_inst_url')) { $this->setViewVariable('inst_inst_url', 'http://www.hispalinux.es'); } if (!$this->issetViewVariable('inst_director_name')) { $this->setViewVariable('inst_director_name', 'Juan Español'); } if (!$this->issetViewVariable('inst_director_email')) { $this->setViewVariable('inst_director_email', 'root@localhost'); } if (!$this->issetViewVariable('inst_inst_phone')) { $this->setViewVariable('inst_inst_phone', '(515) 648 208'); } $this->setViewVariable('inst_campus_lang', $this->obj_data->getAllLang()); if (!$this->issetViewVariable('inst_admin_name')) { $this->setViewVariable('inst_admin_name', 'Juan'); } if (!$this->issetViewVariable('inst_admin_surname')) { $this->setViewVariable('inst_admin_surname', 'Español'); } if (!$this->issetViewVariable('inst_admin_user')) { $this->setViewVariable('inst_admin_user', 'admin'); } if (!$this->issetViewVariable('inst_admin_passwd')) { $this->setViewVariable('inst_admin_passwd', ''); } if (!$this->issetViewVariable('inst_cript_passwd')) { $this->setViewVariable('inst_cript_passwd', true); } $this->setViewVariable("install_step", 5); break; case 6: $this->setViewVariable("install_step", 6); break; case 7: $this->setViewVariable("install_step", 7); break; } if ($this->currentStep == 0) { $step = "Salida a petición de usuario."; } else { $step = "Paso " . $this->currentStep . " de 7."; } $this->setSessionElement('install_step', $this->currentStep); $this->setPageTitle("miguel Instalation Page"); if ($message == '') { $this->setMessage('Proceso de instalación y configuración de su plataforma miguel - ' . $step); } else { $this->setMessage($message); } $this->setHelp("EducInstall"); }
/** * Escribe un mensaje en el log * @param string $message Mensaje a guardar en el Log * @param string $priority Nivel de log */ function log($message, $priority) { include_once Util::base_Path('include/classes/loghandler.class.php'); LogHandler::log($message, $this->str_moduleName . '_controller', $priority); }
function SendNotification() { //Realiza la notificacion si esta permitido if ($this->getSessionElement('userinfo', 'notify_email')) { include_once Util::base_Path("include/classes/mailer.class.php"); $mail = new miguel_mailer(); $mail->From = $this->getSessionElement('userinfo', 'email'); $mail->FromName = $this->getSessionElement('userinfo', 'name') . ' ' . $this->getSessionElement('userinfo', 'surname'); $mail->AddAddress($this->getSessionElement('userinfo', 'email'), $this->getSessionElement('userinfo', 'name')); $mail->AddReplyTo($this->getSessionElement('userinfo', 'email'), $this->getSessionElement('userinfo', 'name')); $mail->Subject = agt('miguel_newCourseSubject') . ' ' . $courseData['name']; $mail->Body = $course_name . ',\\n ' . agt('miguel_newCourseSubscriptionBody') . '\\n' . agt('miguel_disclaimer'); if (!$mail->Send()) { echo "Message could not be sent. <p>"; echo "Mailer Error: " . $mail->ErrorInfo; } } }
function prepareTheme($theme) { include_once Util::base_Path('include/classes/theme.class.php'); //Comprobamos si el tema existe if (!Theme::existTheme($theme)) { $theme = Session::getContextValue('theme'); } //Configuración theme $file = MIGUELBASE_THEME_DIR . $theme . '/theme.xml'; if (file_exists($file)) { miguel_UserInfo::_processXMLInitData($file); } else { $this->_setError("miguel_UserInfo:: el tema visual no está configurado"); } }
| the world-wide-web at http://www.gnu.org/copyleft/gpl.html | +----------------------------------------------------------------------+ | Authors: Jesus A. Martinez Cerezal <*****@*****.**> | | miguel Development Team | | <*****@*****.**> | +----------------------------------------------------------------------+ */ /** * Todo el patrón MVC se define es este paquete llamado framework * @package framework * @subpackage view */ /** * */ include_once Util::base_Path('view/includes.inc.php'); /** * Define la clase base para las pantallas de miguel. * * Se define una plantilla común para todas las pantallas de miguel: * + Bloque de cabecera en la parte superior. * + Bloque central, donde se presentará la información * + Bloque de pie en la parte inferior * <pre> * -------------------------------- * | header block | * -------------------------------- * | | * | data block | * | | * --------------------------------
+----------------------------------------------------------------------+ */ /** * Define la clase base para las pantallas especiales de miguel. * * Utiliza la libreria phphtmllib. * * @author Jesus A. Martinez Cerezal <*****@*****.**> * @author miguel development team <*****@*****.**> * @copyright GPL - Ver LICENCE * @package framework * @subpackage view * @version 1.0.0 * */ include_once Util::base_Path("view/classes/base_layoutpage.class.php"); class miguel_VBase extends base_LayoutPage { var $str_title = ''; function miguel_VBase($str_title, $arr_commarea) { $this->str_title = $str_title; $this->base_LayoutPage($this->str_title, $arr_commarea); } function initialize() { //Preparamos valores para los header de la página // <META HTTP-EQUIV="refresh" content="5; URL=http://"> // html_meta (string $content, [string $http_equiv = ""], [string $name = ""]) //$this->add_head_content("<meta http-equiv=\"refresh\" content=\"5\" url=\"".Util::main_URLPath('index.php')."\">"); $this->add_head_content("<meta name=\"keywords\" content=\"miguel,hispalinux,indetec,campus,ecampus,e-campus,classroom,elearning,learning,pedagogy,platform,teach,teaching,teacher,prof,professor,student,study,open,source,gpl,mysql,php,e-learning, apprentissage,ecole,universite,university,contenu,classe, universidad, enseñanza, virtual, distribuida, sl, gpl, software, libre, clases, aprendizaje, proceso\">");
| along with this program; if not, write to the Free Software | | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | | 02111-1307, USA. The GNU GPL license is also available through | | the world-wide-web at http://www.gnu.org/copyleft/gpl.html | +----------------------------------------------------------------------+ | Authors: Jesus A. Martinez Cerezal <*****@*****.**> | | miguel Development Team | | <*****@*****.**> | +----------------------------------------------------------------------+ */ /* Modo de uso Debug::msg('Hola', __FILE__, __LINE__); */ include_once Util::base_Path('include/classes/lensdebug.class.php'); class Debug { function msg($a, $file, $line) { if (MIGUELBASE_DEBUG) { $D = new LensDebug(); $D->msg($a, $file, $line); } } function oneVar($a, $file, $line) { if (MIGUELBASE_DEBUG) { $D = new LensDebug(); $D->v($a, $file, $line); }
/** * Informa de los temas instalados. * * @return array Lista de temas. * * @access public * */ function listThemes() { include_once Util::base_Path('include/classes/theme.class.php'); return Theme::getActiveThemes(); }