function _getFileContent($file) { $data = 'Fichero vacio o no existe'; $filename = Util::formatPath(MIGUEL_APPDIR . 'var/carton/' . $file); //Debug::oneVar($filename, __FILE__, __LINE__); if (file_exists($filename)) { ob_start(); include_once "{$filename}"; $data = ob_get_contents(); ob_end_clean(); } //Debug::oneVar($data, __FILE__, __LINE__); return $data; }
function processPetition() { $arr_cvw = $this->getSessionData(); //Debug::oneVar($arr_cvw, __FILE__,__LINE__); //Obtención del id de curso //Parametro temporal para demo $course_id = $this->getViewVariable('id'); if (!isset($course_id)) { if (!isset($arr_cvw['course_id'])) { $course_id = 8; } else { $course_id = $arr_cvw['course_id']; } } else { $arr_cvw = array(); } //En un futuro deberia ser lo siguiente //$course_id = Session::getValue('course_id'); if ($course_id != $arr_cvw['course_id']) { unset($arr_cvw); $arr_cvw['course_id'] = $course_id; } //Si el curso se inicializa correctamente... if (isset($course_id) && $course_id != '') { include_once Util::app_Path('common/control/classes/miguel_courseinfo.class.php'); $infoCourse = miguel_CourseInfo::getInfo($this->obj_data, $course_id); //Debug::oneVar($infoCourse, __FILE__,__LINE__); //$this->setViewVariable('infoCourse', $infoCourse); //$arr_cvw['module_path'] = $this->obj_data->CourseModules($course_id); //Se obtiene el orden de documentos $arr_cvw['sec_docs'] = $this->obj_data->CourseModulesOrder($course_id); //Hay que ver si se nos redirecciona desde el exterior //Si existe la variable mid (id de módulo) reorientamos el índice $module_id = $this->getViewVariable('mid'); if (isset($module_id) && $module_id != '') { $this->moveIndex($module_id, $arr_cvw); } else { //Hay que navegar $option = $this->getViewVariable('opt'); //$this->processNavigation($option, $arr_cvw); $index = $arr_cvw['index']; $document_id = $arr_cvw['sec_docs'][$index]['document']; //Procesar datos de formulario if ($arr_cvw['accion']) { //Procesamos el formulario, si existe $this->processForm($document_id, $arr_cvw); //Sólo si no hay que mostrar un resultado se sigue if (!isset($arr_cvw['result'])) { //Procesamos la navegacion $this->processNavigation($option, $arr_cvw); } } else { $this->processNavigation($option, $arr_cvw); } } $index = $arr_cvw['index']; $document_id = $arr_cvw['sec_docs'][$index]['document']; $module_id = $arr_cvw['sec_docs'][$index]['module']; $arr_path = $this->getFolderNavInfo($document_id); //Debug::oneVar($arrPath, __FILE__,__LINE__); if ($arr_path['fl_type']) { $this->setViewVariable('view_elem', $this->processNextForm($arr_cvw)); $this->setViewClass('miguel_VCourseActioner'); $arr_cvw['accion'] = true; } else { $this->setViewClass('miguel_VCourseViewer'); $arr_cvw['accion'] = false; } $this->setViewVariable('ban_mid', $this->obj_data->getCourseModulesPosition($arr_cvw['course_id'], $module_id)); $this->setViewVariable('esInicio', $index == 0); $this->setViewVariable('hayPrevio', $index != 0); $this->setViewVariable('haySiguiente', $index < count($arr_cvw['sec_docs']) - 1); $this->setViewVariable('actual', Util::formatPath(MIGUEL_APPDIR . 'var/courses/course_' . $course_id . '/pages/' . $arr_path['fl_actual'])); //Util::formatPath(MIGUEL_APPDIR.'var/courses/'.$file); $this->setViewVariable('path', 'var/courses/course_' . $course_id . '/pages/'); //Guardamos variables de navegacion $this->setSessionElement('cvw', $arr_cvw); $this->addNavElement(Util::format_URLPath("courseViewer/index.php", 'url=' . $this->getViewVariable('url') . '&name=' . $this->getViewVariable('name')), $infoCourse['description']); $this->setPageTitle("miguel Course Viewer Page "); $this->setMessage(''); //$this->setCacheFile("miguel_vParser"); $this->setCacheFlag(true); $this->setHelp(""); } }
function format_pathApp($str_path) { return Util::formatPath(MIGUELBASE_MAINDIR . chop($str_path)); }
/** * Cheks a file or a directory actually exist at this location * * @author - Hugues Peeters <*****@*****.**> * @param - filePath (string) - path of the presume existing file or dir * @return - boolean TRUE if the file or the directory exists * boolean FALSE otherwise. */ function check_name_exist($fileName) { //$filePath = "/Library/WebServer/Documents/migueloo/var/data/"; $filePath = Util::formatPath(MIGUEL_APPDIR . 'var/data/'); clearstatcache(); if (chdir(dirname($filePath))) { if (file_exists($fileName)) { return true; } else { return false; } return true; } else { return true; } }
function _menuFile() { if (Session::getValue('USERINFO_USER_ID') != null) { $file_name = Session::getValue('menufile'); if (empty($file_name)) { $file_name = 'menu_item_' . Session::getValue('USERINFO_USER_ID') . '_' . date("YmdHis") . '.js'; } $menuFile = Util::formatPath(MIGUELBASE_CACHE_DIR . '/' . $file_name); if (file_exists($menuFile) && time() - filemtime($menuFile) < MIGUELBASE_CACHE_TIME) { File::Touch($menuFile); } else { //Si existe, se borra if (file_exists($menuFile)) { File::Delete($menuFile); } //Se crea, según el perfil de usuario switch (Session::getValue('USERINFO_PROFILE_ID')) { case 1: $strFile = 'menu_admin'; break; case 2: case 3: $strFile = 'menu_profesor'; break; case 4: $strFile = 'menu_alumno'; break; case 5: $strFile = 'menu_secretaria'; break; default: $strFile = 'menu'; break; } include_once Util::app_Path("common/control/classes/miguel_menubar.class.php"); $menubar = new miguel_MenuBar($strFile . '.xml'); $str_content = 'var MENU_ITEMS = ['; for ($i = 0; $i < $menubar->countMenu(); $i++) { $str_content .= $menubar->getMenuCode($i, $superior); } $str_content .= '];'; if (file_exists($menuFile)) { File::Delete($menuFile); } File::Write($menuFile, $str_content); } $this->setViewVariable('menufile', MIGUEL_URLDIR . 'var/cache/' . "{$file_name}"); Session::setValue('menufile', $file_name); } }
function processNewBook() { $all_Ok = false; if ($this->checkVar('ptabla01', 'titulo de la obra') && $this->checkVar('autor', 'autor de la obra') && $this->checkVar('descripcion', 'descripción')) { if ($_FILES['imagen']['tmp_name'] != null) { list($name, $ext) = explode(".", $_FILES['imagen']['name']); } else { $filename = ''; } $book_id = $this->obj_data->newBook($this->getViewVariable('ptabla01'), $this->getViewVariable('autor'), $this->getViewVariable('f_edicion'), $this->getViewVariable('editorial'), $this->getViewVariable('lugar_pub'), $this->getViewVariable('descripcion'), $this->getViewVariable('indice'), $this->getViewVariable('isbn'), $ext); $all_Ok = true; if ($_FILES['imagen']['tmp_name'] != null) { $filename = 'bookref_' . $book_id . '.' . $ext; //Procesamos fichero imagen $file_orig = $_FILES['imagen']['tmp_name']; if (is_uploaded_file($file_orig)) { $file_dest = Util::formatPath(MIGUEL_APPDIR . 'var/bibliography/image/' . $filename); move_uploaded_file($file_orig, $file_dest); } } } else { $message = 'Error: Rellene todos los campos obligatorios (*).'; } return $all_Ok; }
/** * Define la estructura global de la página * */ function body_content() { $this->set_body_attributes("bgcolor=\"yellow\""); //add the header area $this->add(html_comment("Header block begins")); $this->add($this->header_block()); $this->add(html_comment("Header block ends")); //add it to the page //build the outer wrapper div //that everything will live under $wrapper_div = html_div(); $wrapper_div->set_id("mainarea"); //add the main body $wrapper_div->add(html_comment("Main block begins")); NLS::setTextdomain($this->registry->gettextDomain(), Util::formatPath(MIGUELGETTEXT_DIR), NLS::getCharset()); $wrapper_div->add($this->main_block()); $wrapper_div->add(html_comment("Main block ends")); $this->add($wrapper_div); }
/** * Elimina de la pila el módulo, restaurando el siguiente módulo en la pila. * * @return string The name of the application that was popped. * * @access public */ function popApp() { /* Pop the current application off of the stack. */ if (count($this->_appStack) > 1) { $previous = array_pop($this->_appStack); /* Import the new active application's configuration values and set the gettext domain and the preferred language. */ $this->_currentApp = count($this->_appStack) ? end($this->_appStack) : null; if ($this->_currentApp) { NLS::setLang(); NLS::setTextdomain($this->modules[$this->_currentApp]['gettext'], Util::formatPath(MIGUELGETTEXT_DIR), NLS::getCharset()); } } }
function processAddCandidate($person_id) { //$this->setViewVariable('treatmentList', $this->obj_data->getTreatmentList()); if ($this->issetViewVariable("submit")) { $process1 = $this->checkVar('nom_form', 'Nombre'); $process2 = $this->checkVar('prenom_form', 'Primer apellido'); $process3 = $this->checkVar('prenom_form2', 'Segundo apellido'); $process4 = $this->checkVar('email', 'E-mail'); $process5 = $this->checkVar('telefono1', 'Teléfono'); if ($process1 && $process2 && $process3 && $process4 && $process5) { if ($_FILES['imagen']['tmp_name'] != null) { list($name, $ext) = explode(".", $_FILES['imagen']['name']); } if ($_FILES['cv_doc']['tmp_name'] != null) { list($namecv, $extcv) = explode(".", $_FILES['cv_doc']['name']); } $profile = 4; //Siempre alumnos //$fecha = $this->getViewVariable('_years') . '-' . $this->getViewVariable('_months') . '-' . $this->getViewVariable('_days'); //if($this->getViewVariable('passwd') == $this->getViewVariable('passwd2')){ $user_id = $this->obj_data->newInscription($this->getViewVariable('nif'), $this->getViewVariable('nom_form'), $this->getViewVariable('prenom_form'), $this->getViewVariable('prenom_form2'), $this->getViewVariable('calle'), $this->getViewVariable('localidad'), $this->getViewVariable('provincia'), $this->getViewVariable('pais'), $this->getViewVariable('codigo_postal'), $this->getViewVariable('telefono1'), $this->getViewVariable('telefono2'), $this->getViewVariable('fax'), $this->getViewVariable('email'), $this->getViewVariable('email2'), $this->getViewVariable('email3'), $this->getViewVariable('web'), $this->getViewVariable('observaciones'), $ext, $extcv, $profile); if ($_FILES['imagen']['tmp_name'] != null) { $filename = 'user_' . $user_id . '.' . $ext; //Procesamos fichero imagen $file_orig = $_FILES['imagen']['tmp_name']; if (is_uploaded_file($file_orig)) { $file_dest = Util::formatPath(MIGUEL_APPDIR . 'var/secretary/user_image/' . $filename); move_uploaded_file($file_orig, $file_dest); } } if ($_FILES['cv_doc']['tmp_name'] != null) { $filename = 'user_' . $user_id . '.' . $ext; //Procesamos fichero imagen $file_orig = $_FILES['cv_doc']['tmp_name']; if (is_uploaded_file($file_orig)) { $file_dest = Util::formatPath(MIGUEL_APPDIR . 'var/secretary/user_cv/' . $filename); move_uploaded_file($file_orig, $file_dest); } } //Todo Ok, borramos candidato return $this->obj_data->deleteCandidateData($person_id); } } }