コード例 #1
0
 /**
  * Muestra el formulario para iniciar sesión.
  */
 private function imprimirFormularioLogin()
 {
     imprimirTabulados(5);
     echo '<div class="tablaTituloBotones">';
     imprimirTabulados(6);
     echo '<h2>Iniciar sesión</h2>';
     imprimirTabulados(6);
     echo '<form action="index.php" method="post">';
     imprimirTabulados(6);
     echo '<fieldset class="login">';
     imprimirTabulados(6);
     $clase = array('class' => 'tablaCarga');
     $tabla = new HTML_Table($clase);
     $tabla->setAutoGrow(true);
     $tabla->setHeaderContents(0, 0, 'Usuario');
     $tabla->setCellContents(0, 1, '<input class="campoTexto campoTextoAlineado" type="text" name="username" value="" />');
     $tabla->setHeaderContents(1, 0, 'Contraseña');
     $tabla->setCellContents(1, 1, '<input class="campoTexto campoTextoAlineado" type="password" name="password" value="" />');
     $tabla->setColAttributes(0, $clase);
     $tabla->setColAttributes(1, $clase);
     echo $tabla->toHtml();
     imprimirTabulados(6);
     echo '<br /><input type="submit" name="botonIniciarSesion"  value="Iniciar sesión" >';
     imprimirTabulados(6);
     echo '</fieldset>';
     imprimirTabulados(6);
     echo '</form>';
     imprimirTabulados(5);
     echo '</div>';
 }
コード例 #2
0
function lp_upload_quiz_main()
{
    // variable initialisation
    $lp_id = isset($_GET['lp_id']) ? intval($_GET['lp_id']) : null;
    $form = new FormValidator('upload', 'POST', api_get_self() . '?' . api_get_cidreq() . '&lp_id=' . $lp_id, '', array('enctype' => 'multipart/form-data'));
    $form->addElement('header', get_lang('ImportExcelQuiz'));
    $form->addElement('file', 'user_upload_quiz', get_lang('FileUpload'));
    $link = '<a href="../exercice/quiz_template.xls">' . Display::return_icon('export_excel.png', get_lang('DownloadExcelTemplate')) . get_lang('DownloadExcelTemplate') . '</a>';
    $form->addElement('label', '', $link);
    $table = new HTML_Table(array('class' => 'table'));
    $tableList = array(UNIQUE_ANSWER => get_lang('UniqueSelect'), MULTIPLE_ANSWER => get_lang('MultipleSelect'), FILL_IN_BLANKS => get_lang('FillBlanks'), MATCHING => get_lang('Matching'), FREE_ANSWER => get_lang('FreeAnswer'), GLOBAL_MULTIPLE_ANSWER => get_lang('GlobalMultipleAnswer'));
    $table->setHeaderContents(0, 0, get_lang('QuestionType'));
    $table->setHeaderContents(0, 1, '#');
    $row = 1;
    foreach ($tableList as $key => $label) {
        $table->setCellContents($row, 0, $label);
        $table->setCellContents($row, 1, $key);
        $row++;
    }
    $table = $table->toHtml();
    $form->addElement('label', get_lang('QuestionType'), $table);
    $form->addElement('checkbox', 'user_custom_score', null, get_lang('UseCustomScoreForAllQuestions'), array('id' => 'user_custom_score'));
    $form->addElement('html', '<div id="options" style="display:none">');
    $form->addElement('text', 'correct_score', get_lang('CorrectScore'));
    $form->addElement('text', 'incorrect_score', get_lang('IncorrectScore'));
    $form->addElement('html', '</div>');
    $form->addRule('user_upload_quiz', get_lang('ThisFieldIsRequired'), 'required');
    $form->add_progress_bar();
    $form->addButtonUpload(get_lang('Upload'), 'submit_upload_quiz');
    // Display the upload field
    $form->display();
}
コード例 #3
0
 public function show_html()
 {
     $sections = array('chamilo', 'php', 'database', 'webserver', 'paths');
     $currentSection = isset($_GET['section']) ? $_GET['section'] : 'chamilo';
     if (!in_array(trim($currentSection), $sections)) {
         $currentSection = 'chamilo';
     }
     $html = '<div class="tabbable"><ul class="nav nav-tabs">';
     foreach ($sections as $section) {
         if ($currentSection === $section) {
             $html .= '<li class="active">';
         } else {
             $html .= '<li>';
         }
         $params['section'] = $section;
         $html .= '<a href="system_status.php?section=' . $section . '">' . get_lang($section) . '</a></li>';
     }
     $html .= '</ul><div class="tab-pane">';
     $data = call_user_func(array($this, 'get_' . $currentSection . '_data'));
     echo $html;
     if ($currentSection != 'paths') {
         $table = new SortableTableFromArray($data, 1, 100);
         $table->set_header(0, '', false);
         $table->set_header(1, get_lang('Section'), false);
         $table->set_header(2, get_lang('Setting'), false);
         $table->set_header(3, get_lang('Current'), false);
         $table->set_header(4, get_lang('Expected'), false);
         $table->set_header(5, get_lang('Comment'), false);
         $table->display();
     } else {
         $headers = $data['headers'];
         $results = $data['data'];
         $table = new HTML_Table(array('class' => 'data_table'));
         $column = 0;
         foreach ($headers as $header) {
             $table->setHeaderContents(0, $column, $header);
             $column++;
         }
         $row = 1;
         foreach ($results as $index => $rowData) {
             $table->setCellContents($row, 0, $rowData);
             $table->setCellContents($row, 1, $index);
             $row++;
         }
         echo $table->display();
     }
     echo '</div></div>';
 }
コード例 #4
0
 private function filaTablaHorasAsignadasEditar($horario, $fila)
 {
     // Debe sumarse uno a la fila porque la fila 0 es la cabecera
     $this->tabla->setCellContents($fila + 1, 0, $this->formulario . $horario->getArea()->getNombreArea());
     $this->tabla->setCellContents($fila + 1, 1, '<input class="campoTexto campoTextoChico" type="text" name="cantidadHoras" size="4" value="' . $horario->getHorasAsignadas() . '" />');
     $this->tabla->setCellContents($fila + 1, 2, $horario->getHorasActualmenteAsignadas());
     $this->tabla->setCellContents($fila + 1, 3, $this->accionesFilaTablaHorasAsignadasEditar($horario->getArea()->getIdArea()));
     $this->tabla->setRowAttributes($fila + 1, $this->clase, false);
 }
コード例 #5
0
 /**
  * View list
  *
  * @author	John.meng
  * @since    version1.0 - Dec 12, 2005
  */
 function viewList()
 {
     global $__Lang__, $FlushPHPObj, $smarty;
     include_once PEAR_DIR . "HTML/Table.php";
     include_once PEAR_DIR . "HTML/QuickForm.php";
     include_once APP_DIR . "UI.class.php";
     $form =& new HTML_QuickForm();
     $FilesDirsObj = $FlushPHPObj->loadUtility("FilesDirs");
     $FilesDirsObj->FilesDirs(MODULE_DIR, 1, "CVS,General");
     $Module_arr = $FilesDirsObj->listDirs();
     asort($Module_arr);
     reset($Module_arr);
     $data = array();
     $installImageObj = new UIImage(THEMES_DIR . "images/install.gif");
     $unInstallImageObj = new UIImage(THEMES_DIR . "images/uninstall.gif");
     if (sizeof($Module_arr)) {
         foreach ($Module_arr as $key => $value) {
             $temp_Module_arr = $FlushPHPObj->getModuleInfo($value);
             if (file_exists(MODULE_DIR . "/" . $temp_Module_arr['name'] . "/" . $temp_Module_arr['logo']) && $temp_Module_arr['logo']) {
                 $ModuleImageLogo = new UIImage(MODULE_DIR . "/" . $temp_Module_arr['name'] . "/" . $temp_Module_arr['logo']);
                 $Module_logo = $ModuleImageLogo->toHTML() . "<br/>";
             }
             $data[$key] = array($Module_logo . $temp_Module_arr['name'] . " <b> " . $temp_Module_arr['version'] . " <b/> ", $temp_Module_arr['description'], $temp_Module_arr['author'], $unInstallImageObj->toHTML() . "<br/>" . $__Lang__['langGeneralUnInstall'], $installImageObj->toHTML() . "<br/>" . $__Lang__['langGeneralInstall']);
         }
     }
     $tableAttrs = array("class" => "grid_table");
     $table = new HTML_Table($tableAttrs);
     $table->setAutoGrow(true);
     $table->setAutoFill("n/a");
     for ($nr = 0; $nr < count($data); $nr++) {
         $table->setHeaderContents($nr + 1, 0, (string) $nr);
         for ($i = 0; $i < 5; $i++) {
             if ("" != $data[$nr][$i]) {
                 $table->setCellContents($nr + 1, $i + 1, $data[$nr][$i]);
             }
         }
     }
     $table->setColAttributes(3, array(" align" => "center"));
     $table->setColAttributes(4, array(" align" => "center"));
     $table->setColAttributes(5, array(" align" => "center"));
     $altRow = array("class" => "grid_table_tr_alternate");
     $table->altRowAttributes(1, null, $altRow);
     $table->setHeaderContents(0, 0, "");
     $table->setHeaderContents(0, 1, $__Lang__['langMenuModule']);
     $table->setHeaderContents(0, 2, $__Lang__['langGeneralSummary']);
     $table->setHeaderContents(0, 3, $__Lang__['langGeneralAuthor']);
     $table->setHeaderContents(0, 4, $__Lang__['langGeneralStatus']);
     $table->setHeaderContents(0, 5, $__Lang__['langGeneralOperation']);
     $hrAttrs = array("class" => "grid_table_head");
     $table->setRowAttributes(0, $hrAttrs, true);
     $table->setColAttributes(0, $hrAttrs);
     $smarty->assign("Main", $table->toHtml());
 }
コード例 #6
0
 /**
  * Get HTML table (as string that can be echoed)
  *
  * @param array $row_data (to appear in rows of table)
  * @param array $column_headers (to appear in head of table
  * @return string
  *
  * @access private
  */
 private function get_table($row_data, $column_headers, $delete = false, $deleteColumn = -999, $deleteField = 'dummy-field-name')
 {
     // see http://pear.php.net/manual/en/package.html.html-table.intro.php
     $table = new HTML_Table();
     $table->setAutoGrow(true);
     $table->setAutoFill('n/a');
     for ($nr = 0, $maxr = count($row_data); $nr < $maxr; $nr++) {
         for ($i = 0, $ii = count($column_headers); $i < $ii; $i++) {
             if (isset($row_data[$nr][$i])) {
                 if ('' != $row_data[$nr][$i]) {
                     if ($deleteColumn == $i) {
                         if ($delete) {
                             $table->setCellContents($nr + 1, $i, $this->getDeleteButton($row_data[$nr][$i], $deleteField));
                         }
                     } else {
                         $table->setCellContents($nr + 1, $i, $row_data[$nr][$i]);
                     }
                 }
             } else {
                 $table->setCellContents($nr + 1, $i, $this->fillerForEmptyCell);
             }
         }
     }
     for ($i = 0, $ii = count($column_headers); $i < $ii; $i++) {
         $table->setHeaderContents(0, $i, $column_headers[$i]);
     }
     $header_attribute = array('class' => 'header');
     $table->setRowAttributes(0, $header_attribute, true);
     $table->setColAttributes(0, $header_attribute);
     $altRow = array('class' => 'alt_row');
     $table->altRowAttributes(1, null, $altRow);
     return $table->toHtml();
 }
コード例 #7
0
ファイル: student_work.php プロジェクト: ragebat/chamilo-lms
$column = 0;
$row = 0;
$headers = array(get_lang('Title'), get_lang('HandedOutDate'), get_lang('HandOutDateLimit'), get_lang('Score'), get_lang('Actions'));
foreach ($headers as $header) {
    $table->setHeaderContents($row, $column, $header);
    $column++;
}
$row++;
$column = 0;
foreach ($workPerUser as $work) {
    $work = $work['work'];
    $scoreWeight = intval($work->qualification) == 0 ? null : $work->qualification;
    $workId = $work->id;
    $workExtraData = get_work_assignment_by_id($workId);
    foreach ($work->user_results as $userResult) {
        $table->setCellContents($row, $column, $work->title . ' [' . strip_tags($userResult['title']) . ']');
        $table->setCellAttributes($row, $column, array('width' => '300px'));
        $column++;
        $table->setCellContents($row, $column, $userResult['sent_date']);
        $column++;
        $dateQualification = !empty($workExtraData['expires_on']) && $workExtraData['expires_on'] != '0000-00-00 00:00:00' ? api_get_local_time($workExtraData['expires_on']) : '-';
        $table->setCellContents($row, $column, $dateQualification);
        $column++;
        $score = '-';
        if (!empty($scoreWeight)) {
            $score = strip_tags($userResult['qualification']) . "/" . $scoreWeight;
        }
        $table->setCellContents($row, $column, $score);
        $column++;
        // Actions
        $links = null;
コード例 #8
0
 /**
  * Returns a category summary report
  * @params int exercise id
  * @params array pre filled array with the category_id, score, and weight
  * example: array(1 => array('score' => '10', 'total' => 20));
  */
 public static function get_stats_table_by_attempt($exercise_id, $category_list = array())
 {
     if (empty($category_list)) {
         return null;
     }
     $category_name_list = TestCategory::getListOfCategoriesNameForTest($exercise_id);
     $table = new HTML_Table(array('class' => 'data_table'));
     $table->setHeaderContents(0, 0, get_lang('Categories'));
     $table->setHeaderContents(0, 1, get_lang('AbsoluteScore'));
     $table->setHeaderContents(0, 2, get_lang('RelativeScore'));
     $row = 1;
     $none_category = array();
     if (isset($category_list['none'])) {
         $none_category = $category_list['none'];
         unset($category_list['none']);
     }
     $total = array();
     if (isset($category_list['total'])) {
         $total = $category_list['total'];
         unset($category_list['total']);
     }
     if (count($category_list) > 1) {
         foreach ($category_list as $category_id => $category_item) {
             $table->setCellContents($row, 0, $category_name_list[$category_id]);
             $table->setCellContents($row, 1, ExerciseLib::show_score($category_item['score'], $category_item['total'], false));
             $table->setCellContents($row, 2, ExerciseLib::show_score($category_item['score'], $category_item['total'], true, false, true));
             $row++;
         }
         if (!empty($none_category)) {
             $table->setCellContents($row, 0, get_lang('None'));
             $table->setCellContents($row, 1, ExerciseLib::show_score($none_category['score'], $none_category['total'], false));
             $table->setCellContents($row, 2, ExerciseLib::show_score($none_category['score'], $none_category['total'], true, false, true));
             $row++;
         }
         if (!empty($total)) {
             $table->setCellContents($row, 0, get_lang('Total'));
             $table->setCellContents($row, 1, ExerciseLib::show_score($total['score'], $total['total'], false));
             $table->setCellContents($row, 2, ExerciseLib::show_score($total['score'], $total['total'], true, false, true));
         }
         return $table->toHtml();
     }
     return null;
 }
コード例 #9
0
 /**
  * Muestra el formulario para dar de alta un nuevo usuario.
  */
 private function imprimirFormularioNuevoUsuario()
 {
     imprimirTabulados(5);
     echo '<div class="tablaTituloBotones">';
     imprimirTabulados(6);
     echo '<h1>Nuevo usuario</h1>';
     imprimirTabulados(6);
     echo '<form action="usuario.php" method="post">';
     imprimirTabulados(6);
     echo '<fieldset>';
     imprimirTabulados(6);
     $clase = array('class' => 'tablaCarga');
     $tabla = new HTML_Table($clase);
     $tabla->setAutoGrow(true);
     $tabla->setHeaderContents(0, 0, 'Tipo de documento');
     $tabla->setCellContents(0, 1, '<select class="cuadroSeleccion cuadroSeleccionAlineado" name="tipoDocumento"><option>DNI</option><option>LE</option><option>LC</option></select>');
     $tabla->setHeaderContents(1, 0, 'Número de documento *');
     $tabla->setCellContents(1, 1, '<input class="campoTexto campoTextoAlineado" type="text" name="numeroDocumentoNuevo" value="" />');
     $tabla->setHeaderContents(2, 0, 'Nombre *');
     $tabla->setCellContents(2, 1, '<input class="campoTexto campoTextoAlineado" type="text" name="nombre" value="" />');
     $tabla->setHeaderContents(3, 0, 'Segundo nombre');
     $tabla->setCellContents(3, 1, '<input class="campoTexto campoTextoAlineado" type="text" name="segundoNombre" value="" />');
     $tabla->setHeaderContents(4, 0, 'Apellido *');
     $tabla->setCellContents(4, 1, '<input class="campoTexto campoTextoAlineado" type="text" name="apellido" value="" />');
     $tabla->setHeaderContents(5, 0, 'Fecha de nacimiento *');
     $tabla->setCellContents(5, 1, '<input class="campoTexto campoTextoAlineado" type="text" name="fechaNacimiento" value="DD-MM-AAAA" />');
     $tabla->setHeaderContents(6, 0, 'Dirección *');
     $tabla->setCellContents(6, 1, '<input class="campoTexto campoTextoAlineado" type="text" name="direccion" value="" />');
     $tabla->setHeaderContents(7, 0, 'Teléfono fijo');
     $tabla->setCellContents(7, 1, '<input class="campoTexto campoTextoAlineado" type="text" name="telefonoFijo" value="" />');
     $tabla->setHeaderContents(8, 0, 'Teléfono celular');
     $tabla->setCellContents(8, 1, '<input class="campoTexto campoTextoAlineado" type="text" name="telefonoCelular" value="" />');
     $tabla->setHeaderContents(9, 0, 'E-mail *');
     $tabla->setCellContents(9, 1, '<input class="campoTexto campoTextoAlineado" type="text" name="email" value="" />');
     $tabla->setHeaderContents(10, 0, 'Legajo *');
     $tabla->setCellContents(10, 1, '<input class="campoTexto campoTextoAlineado" type="text" name="legajo" value="" />');
     $tabla->setHeaderContents(11, 0, 'Área *');
     $tabla->setCellContents(11, 1, $this->mostrarAreasMultipleSeleccion());
     $tabla->setHeaderContents(12, 0, 'Tipo de usuario');
     $tabla->setCellContents(12, 1, $this->mostrarNiveles());
     $tabla->setHeaderContents(13, 0, 'Activo');
     $tabla->setCellContents(13, 1, '<select class="cuadroSeleccionAlineado" name="activo"><option value="1">Si</option><option value="0">No</option></select>');
     $tabla->setHeaderContents(14, 0, 'Notas');
     $tabla->setCellContents(14, 1, '<textarea class="areaTexto" name="notas" rows="4" cols="20"></textarea>');
     $tabla->setColAttributes(0, $clase);
     $tabla->setColAttributes(1, $clase);
     echo $tabla->toHtml();
     imprimirTabulados(6);
     echo '<br /><input type="submit" name="enviarNuevoUsuario"  value="Enviar" >';
     imprimirTabulados(6);
     echo '</fieldset>';
     imprimirTabulados(6);
     echo '</form>';
     imprimirTabulados(6);
     echo '<div class="notas">';
     imprimirTabulados(7);
     echo '<p>(*) Campos obligatorios</p>';
     imprimirTabulados(6);
     echo '</div>';
     imprimirTabulados(5);
     echo '</div>';
 }
コード例 #10
0
ファイル: listing35-2.php プロジェクト: alannet/example
$table->setHeaderContents(0, 0, "Order ID");
$table->setHeaderContents(0, 1, "Client ID");
$table->setHeaderContents(0, 2, "Order Time");
$table->setHeaderContents(0, 3, "Sub Total");
$table->setHeaderContents(0, 4, "Shipping Cost");
$table->setHeaderContents(0, 5, "Total Cost");
// Cycle through the array to produce the table data
// Create and execute the query
$query = "SELECT id AS `Order ID`, client_id AS `Client ID`,\n                     order_time AS `Order Time`,\n                     CONCAT('\$', sub_total) AS `Sub Total`,\n                     CONCAT('\$', shipping_cost) AS `Shipping Cost`,\n                     CONCAT('\$', total_cost) AS `Total Cost`\n                     FROM sales ORDER BY id";
$stmt = $mysqli->prepare($query);
$stmt->execute();
$stmt->bind_result($orderID, $clientID, $time, $subtotal, $shipping, $total);
// Begin at row 1 so don't overwrite the header
$rownum = 1;
// Format each row
while ($stmt->fetch()) {
    $table->setCellContents($rownum, 0, $orderID);
    $table->setCellContents($rownum, 1, $clientID);
    $table->setCellContents($rownum, 2, $time);
    $table->setCellContents($rownum, 3, $subtotal);
    $table->setCellContents($rownum, 4, $shipping);
    $table->setCellContents($rownum, 5, $total);
    $rownum++;
}
// Output the data
echo $table->toHTML();
// Close the MySQL connection
$mysqli->close();
?>

コード例 #11
0
ファイル: user_stats.php プロジェクト: KRCM13/chamilo-lms
        $header_names = array(get_lang('Evaluation'), get_lang('Course'), get_lang('Category'), get_lang('EvaluationAverage'), get_lang('Result'), get_lang('Display'));
    } else {
        $header_names = array(get_lang('Evaluation'), get_lang('Course'), get_lang('Category'), get_lang('EvaluationAverage'), get_lang('Result'));
    }
    $table = new HTML_Table(array('class' => 'data_table'));
    $row = 0;
    $column = 0;
    foreach ($header_names as $item) {
        $table->setHeaderContents($row, $column, $item);
        $column++;
    }
    $row = 1;
    if (!empty($newarray)) {
        foreach ($newarray as $data) {
            $column = 0;
            $table->setCellContents($row, $column, $data);
            $table->updateCellAttributes($row, $column, 'align="center"');
            $column++;
            $row++;
        }
    }
    $html .= $table->toHtml();
    $pdf = new PDF();
    $pdf->content_to_pdf($html);
    exit;
}
$actions = '<div class="actions">';
if (isset($_GET['selectcat'])) {
    $interbreadcrumb[] = array('url' => 'gradebook_flatview.php?selectcat=' . Security::remove_XSS($_GET['selectcat']), 'name' => get_lang('FlatView'));
    $actions .= '<a href=gradebook_flatview.php?selectcat=' . Security::remove_XSS($_GET['selectcat']) . '>' . Display::return_icon('back.png', get_lang('BackTo') . ' ' . get_lang('FlatView'), '', ICON_SIZE_MEDIUM) . '</a>';
}
コード例 #12
0
 /**
  * Get HTML table (as string that can be echoed)
  *
  * @param array $row_data (to appear in rows of table)
  * @param array $column_headers (to appear in head of table
  * @return string
  *
  * @access public
  */
 public function get_table($row_data, $column_headers)
 {
     // see http://pear.php.net/manual/en/package.html.html-table.intro.php
     $table = new HTML_Table();
     $table->setAutoGrow(true);
     $table->setAutoFill('n/a');
     for ($nr = 0, $maxr = count($row_data); $nr < $maxr; $nr++) {
         for ($i = 0, $ii = count($column_headers); $i < $ii; $i++) {
             if ('' != $row_data[$nr][$i]) {
                 $table->setCellContents($nr + 1, $i, $row_data[$nr][$i]);
             }
         }
     }
     for ($i = 0, $ii = count($column_headers); $i < $ii; $i++) {
         $table->setHeaderContents(0, $i, $column_headers[$i]);
     }
     $header_attribute = array('class' => 'header');
     $table->setRowAttributes(0, $header_attribute, true);
     $table->setColAttributes(0, $header_attribute);
     $altRow = array('class' => 'alt_row');
     $table->altRowAttributes(1, null, $altRow);
     return $table->toHtml();
 }
コード例 #13
0
ファイル: work.lib.php プロジェクト: annickvdp/Chamilo1.9.10
/**
 * @param int $workId
 * @param array $courseInfo
 * @param int $sessionId
 * @param string $format
 * @return bool
 */
function exportAllStudentWorkFromPublication(
    $workId,
    $courseInfo,
    $sessionId,
    $format = 'pdf'
) {
    if (empty($courseInfo)) {
        return false;
    }

    $workData = get_work_data_by_id($workId);

    if (empty($workData)) {
        return false;
    }

    $assignment = get_work_assignment_by_id($workId);

    $courseCode = $courseInfo['code'];
    $header = get_lang('Course').': '.$courseInfo['title'];
    $teachers = CourseManager::get_teacher_list_from_course_code_to_string(
        $courseCode
    );

    if (!empty($sessionId)) {
        $sessionInfo = api_get_session_info($sessionId);
        if (!empty($sessionInfo)) {
            $header .= ' - ' . $sessionInfo['name'];
            $header .= '<br />' . $sessionInfo['description'];
            $teachers = SessionManager::getCoachesByCourseSessionToString(
                $sessionId,
                $courseCode
            );
        }
    }

    $header .= '<br />'.get_lang('Teachers').': '.$teachers.'<br />';
    $header .= '<br />'.get_lang('Date').': '.api_get_local_time().'<br />';
    $header .= '<br />'.get_lang('StudentPublication').': '.$workData['title'].'<br />';

    $content = null;
    $expiresOn = null;

    if (!empty($assignment) && isset($assignment['expires_on'])) {
        $content .= '<br /><strong>' . get_lang('ExpiryDate') . '</strong>: ' . api_get_local_time($assignment['expires_on']);
        $expiresOn = api_get_local_time($assignment['expires_on']);
    }

    if (!empty($workData['description'])) {
        $content .= '<br /><strong>' . get_lang('Description') . '</strong>: ' . $workData['description'];
    }

    $workList = get_work_user_list(null, null, null, null, $workId);

    switch ($format) {
        case 'pdf':
            if (!empty($workList)) {
                require_once api_get_path(LIBRARY_PATH).'pdf.lib.php';

                $table = new HTML_Table(array('class' => 'data_table'));
                $headers = array(
                    get_lang('Name'),
                    get_lang('User'),
                    get_lang('HandOutDateLimit'),
                    get_lang('SentDate'),
                    get_lang('Filename'),
                    get_lang('Score'),
                    get_lang('Feedback')
                );

                $column = 0;
                foreach($headers as $header) {
                    $table->setHeaderContents(0, $column, $header);
                    $column++;
                }

                $row = 1;

                //$pdf->set_custom_header($header);
                foreach ($workList as $work) {
                    $content .= '<hr />';
                    // getWorkComments need c_id
                    $work['c_id'] = $courseInfo['real_id'];

                    //$content .= get_lang('Date').': '.api_get_local_time($work['sent_date_from_db']).'<br />';
                    $score = null;
                    if (!empty($work['qualification_only'])) {
                        $score = $work['qualification_only'];
                    }
                    //$content .= get_lang('Description').': '.$work['description'].'<br />';
                    $comments = getWorkComments($work);

                    $feedback = null;
                    if (!empty($comments)) {
                        $content .= '<h4>'.get_lang('Feedback').': </h4>';
                        foreach ($comments as $comment) {
                            $feedback .= get_lang('User').': '.api_get_person_name(
                                $comment['firstname'],
                                $comment['lastname']
                            ).'<br />';
                            $feedback .= $comment['comment'].'<br />';
                        }
                    }

                    $table->setCellContents($row, 0, strip_tags($workData['title']));
                    $table->setCellContents($row, 1, api_get_person_name(strip_tags($work['firstname']), strip_tags($work['lastname'])));
                    $table->setCellContents($row, 2, $expiresOn);
                    $table->setCellContents($row, 3, api_get_local_time($work['sent_date_from_db']));
                    $table->setCellContents($row, 4, strip_tags($work['title']));
                    $table->setCellContents($row, 5, $score);
                    $table->setCellContents($row, 6, $feedback);

                    $row++;
                }

                $content = $table->toHtml();

                if (!empty($content)) {
                    $params = array(
                        'filename' => $workData['title'] . '_' . api_get_local_time(),
                        'pdf_title' => replace_dangerous_char($workData['title']),
                        'course_code' => $courseInfo['code'],
                        'add_signatures' => false
                    );
                    $pdf = new PDF('A4', null, $params);
                    $pdf->html_to_pdf_with_template($content);
                }
                exit;
            }
            break;
    }
}
コード例 #14
0
ファイル: renliziyuan1.php プロジェクト: simple8888/rm
$table->setHeaderContents(0, 7, "手机");
$table->setHeaderContents(0, 8, "固话");
$table->setHeaderContents(0, 9, "Email");
$table->setHeaderContents(0, 10, "婚否");
$table->setHeaderContents(0, 11, "籍贯");
$table->setHeaderContents(0, 12, "现居住地");
$table->setHeaderContents(0, 13, "特长");
$table->setHeaderContents(0, 14, "备注");
$query = "select id,number,name,sex,birthday,format((timestampdiff(day,birthday,now())/365),2),idno,cell,tel,email,marriage,hometown,livesite,feature,memo FROM yuangong ORDER BY id DESC";
$stmt = $mysqli->prepare($query);
$stmt->execute();
$stmt->bind_result($id, $number, $name, $sex, $birthday, $age, $idno, $cell, $tel, $email, $marriage, $hometown, $livesite, $feature, $memo);
$rownum = 1;
//不是从第0行,而是从第1行开始,所以不会覆盖表头
while ($stmt->fetch()) {
    $table->setCellContents($rownum, 0, $id);
    $table->setCellContents($rownum, 1, $number);
    $table->setCellContents($rownum, 2, $name);
    $table->setCellContents($rownum, 3, $sex);
    $table->setCellContents($rownum, 4, $birthday);
    $table->setCellContents($rownum, 5, $age);
    $table->setCellContents($rownum, 6, $idno);
    $table->setCellContents($rownum, 7, $cell);
    $table->setCellContents($rownum, 8, $tel);
    $table->setCellContents($rownum, 9, $email);
    $table->setCellContents($rownum, 10, $marriage);
    $table->setCellContents($rownum, 11, $hometown);
    $table->setCellContents($rownum, 12, $livesite);
    $table->setCellContents($rownum, 13, $feature);
    $table->setCellContents($rownum, 14, $memo);
    $table->altRowAttributes(1, null, array("class" => "alt"));
コード例 #15
0
ファイル: sms_autoreply.php プロジェクト: laiello/ya-playsms
function showAutoreplyHelp($selfurl)
{
    global $special_codes_notice;
    $backLink = "<a href=\"{$selfurl}&op=list\">[ Back ]</a>";
    $l0tr = "L<b>0</b>TR";
    $header = array('First Keyword', 'Other Keywords', 'Reply');
    $lotrMain = array('LOTR', '', 'Welcome to Lord of the Rings Text!  Text LOTR and the name of the character you would like to know more about.');
    $lotrAragorn = array('LOTR', 'Aragorn', 'Aragorn, also called Strider, was raised by Elves and became king of Gondor.');
    $unknown = array(UNKNOWN, '', 'Sorry I didnt understand that.  Please text LOTR and the character you would like to know more about.');
    $lotrUnknown = array('LOTR', UNKNOWN, 'Sorry we havent entered that character yet.  Please check back later.');
    $lotrUnknownUpdate = 'Sorry we havent entered ' . SUBKEYWORDS . ' yet.  Please check back later.';
    $lotrStrider = array('LOTR', 'Strider', REMATCH . ' ' . KEYWORD0 . ' Aragorn');
    $l0trUnknown = array($l0tr, UNKNOWN, REMATCH . ' ' . 'LOTR' . ' ' . SUBKEYWORDS);
    $rowAttribs = array('valign' => 'top');
    $table = new HTML_Table(array('width' => '50%'));
    foreach ($header as $index => $headerCell) {
        $table->setHeaderContents(0, $index, $headerCell);
    }
    $table->addRow($lotrMain, $rowAttribs);
    $table->addRow($lotrAragorn, $rowAttribs);
    ?>

    <h2>Autoreply Help</h2>
    <?php 
    echo $backLink;
    ?>
    <hr/>

    <p>
    An autoreply is a text that the system sends out in response to a given set of keywords it receives.
    </p>
    
    <p>
    Autoreply "scenarios" are grouped by their first keyword.  Keywords are separated by spaces.
    Replies are sent by <em>matching</em> keywords that are texted to PlaySms with keywords in the autoreply scenarios.
    </p>

    <p>
    <b>Special keywords and variables</b>    
    </p>
    <p>
    Through the use of special keywords and variables, autoreplies can be made to be 'smart'.  That is,
    they can cope with misspellings or alternate names for keywords:  
    
    <?php 
    echo $special_codes_notice;
    ?>
    
    <p>
    In the discussion below we will be using the following example.
    Suppose we are making a Lord of the Rings info line.  We set up the following autoreplies:
    </p>
        
    <p align='center'>
    <?php 
    echo $table->toHtml();
    ?>
    </p>

    <p>
    <b>Using <?php 
    echo UNKNOWN;
    ?>
</b>    
    </p>
    
    <p>
    If someone texts us "LOTR Aragorn" the system will reply with "Aragorn, also called Strider...".
    
    What happens if someone texts us something we don't understand?  Currently, the system won't reply at all,
    which is not very friendly.  We should at least reply with an error message.  How do we reply when there
    are no keyword matches?  For this we use the special keyword <?php 
    echo UNKNOWN;
    ?>
:
    </p>
    
    <p align='center'>
    <?php 
    $table->addRow($unknown, $rowAttribs);
    ?>
    <?php 
    echo $table->toHtml();
    ?>
    </p>

    <p>
    So now if someone texts us something like "HARRY POTTER", the system will reply with "Sorry I didn't understand that...".
    </p>
    
    <p>
    What happens if we get a text for a character we haven't entered yet?  "LOTR FRODO", for example?
    Of course the system will respond with the error message.  But we'd like to have a more specific, LOTR-message.
    For that we can use the <?php 
    echo UNKNOWN;
    ?>
 special keyword again, but this time <em>within</em> the LOTR keyword:
    </p>
    
    <p align='center'>
    <?php 
    $rowIdx = $table->addRow($lotrUnknown, $rowAttribs);
    ?>
    <?php 
    echo $table->toHtml();
    ?>
    </p>
        
    <p>
    Now if someone texts "LOTR FRODO" the system will reply with "Sorry we haven't entered that character...".
    </p>

    <p>
    <b>Using Variables</b>
    </p>

    <p>
    But wouldn't it be nice if we could use the character's name <em>in</em> the error message?
    We can do that with the <?php 
    echo SUBKEYWORDS;
    ?>
 variable.
    Just put it into the reply and it will be replaced with all the keywords after the first one.
    </p>

    <p align='center'>
    <?php 
    $table->setCellContents($rowIdx, 2, $lotrUnknownUpdate);
    ?>
    <?php 
    echo $table->toHtml();
    ?>
    </p>

    <p>
    Now "LOTR FRODO" will get a reply of "Sorry we haven't entered FRODO yet...".
    </p>

    <p>
    <b>Using Rematching</b>
    </p>

    <p>
    Some users of the system may text "LOTR STRIDER", which is another name for Aragorn.  Currently, this will get 
    a reply of "Sorry we haven't entered STRIDER yet...".  We could of course make a separate entry for Strider,
    perhaps even copying and pasting the reply for Aragorn into it.  However, this would get to be very hard to 
    maintain for large numbers of characters, especially if you wanted to correct any typos or add new info.
    (Aragorn has <em>lots</em> of names, by the way.)
    </p>
    
    <p>
    What we need is some way to have one autoreply <em>point</em> to another autoreply.  This is done with the
    special variable <?php 
    echo REMATCH;
    ?>
.  It tells PlaySms to use the autoreply <em>as if</em> it were
    an incoming text, rematching it all over again.  With <?php 
    echo REMATCH;
    ?>
 we can add a STRIDER entry
    that tells PlaySms to really use ARAGORN:
    </p>
    
    <p align='center'>
    <?php 
    $rowIdx = $table->addRow($lotrStrider, $rowAttribs);
    ?>
    <?php 
    echo $table->toHtml();
    ?>
    </p>   
    
    
    <p>
    Note that we also used the variable <?php 
    echo KEYWORD0;
    ?>
.  Why?  We want to transform the reply into a text
    that will match the aragorn entry, which means it must be "LOTR ARAGORN".  When we use <?php 
    echo KEYWORD0;
    ?>
    it gets replaced by "LOTR".
    </p>
    
    <p>
    Finally, what if someone gets confused and texts us "<?php 
    echo $l0tr;
    ?>
 ARAGORN" (note the zero rather than letter oh)?
    We can use rematching to point all <?php 
    echo $l0tr;
    ?>
 texts over to LOTR using one <?php 
    echo UNKNOWN;
    ?>
 entry.
    </p>

    <p align='center'>
    <?php 
    $rowIdx = $table->addRow($l0trUnknown, $rowAttribs);
    ?>
    <?php 
    echo $table->toHtml();
    ?>

    </p>   

    <p>
    Any <?php 
    echo $l0tr;
    ?>
 text that comes in will match against the <?php 
    echo UNKNOWN;
    ?>
 entry (since there are no other <?php 
    echo $l0tr;
    ?>
 entries).
    That entry tells PlaySms to use that reply as if it were an incoming text, which says to use LOTR plus the rest of the
    original keywords.  So "<?php 
    echo $l0tr;
    ?>
 ARAGORN" should give us "Aragorn, also called Strider..."
    </p>
    
    <p>
    What happens if we get "<?php 
    echo $l0tr;
    ?>
 STRIDER"?  The rematches chain off each other:<br/><br/>  
        "<?php 
    echo $l0tr;
    ?>
 STRIDER" => <br/>
        "<?php 
    echo REMATCH;
    ?>
 LOTR <?php 
    echo SUBKEYWORDS;
    ?>
" => <br/>
        "LOTR STRIDER" => <br/>
        "<?php 
    echo REMATCH;
    ?>
 <?php 
    echo KEYWORD0;
    ?>
 Aragorn" => <br/>
        "LOTR Aragorn" => <br/>
        "Aragorn, also called Strider..." 
    </p>

    <p>
    <b>Testing</b>
    </p>

    Its easy to make a mistake when using rematching and <?php 
    echo UNKNOWN;
    ?>
 and the variables.  Plus,
    its expensive to text the system to find out if what you did is working.  To test your autoreplies,
    you can click on the "[ Test ]" link on the Autoreplies page.  This will let you enter in a test text.
    When you click the 'Test' button, PlaySms will show you the autoreply corresponding to what you typed.

    By the way, try creating the last example in this discussion and trying it out using the testing feature.
    
    <?php 
}
コード例 #16
0
 /**
  * @param FlatViewTable $flatviewtable
  * @param Category $cat
  * @param $users
  * @param $alleval
  * @param $alllinks
  * @param array $params
  * @param null $mainCourseCategory
  */
 public static function export_pdf_flatview($flatviewtable, $cat, $users, $alleval, $alllinks, $params = array(), $mainCourseCategory = null)
 {
     // Getting data
     $printable_data = self::get_printable_data($cat[0], $users, $alleval, $alllinks, $params, $mainCourseCategory);
     // HTML report creation first
     $course_code = trim($cat[0]->get_course_code());
     $displayscore = ScoreDisplay::instance();
     $customdisplays = $displayscore->get_custom_score_display_settings();
     $total = array();
     if (is_array($customdisplays) && count($customdisplays)) {
         foreach ($customdisplays as $custom) {
             $total[$custom['display']] = 0;
         }
         $user_results = $flatviewtable->datagen->get_data_to_graph2(false);
         foreach ($user_results as $user_result) {
             $total[$user_result[count($user_result) - 1][1]]++;
         }
     }
     $parent_id = $cat[0]->get_parent_id();
     if (isset($cat[0]) && isset($parent_id)) {
         if ($parent_id == 0) {
             $grade_model_id = $cat[0]->get_grade_model_id();
         } else {
             $parent_cat = Category::load($parent_id);
             $grade_model_id = $parent_cat[0]->get_grade_model_id();
         }
     }
     $use_grade_model = true;
     if (empty($grade_model_id) || $grade_model_id == -1) {
         $use_grade_model = false;
     }
     if ($use_grade_model) {
         if ($parent_id == 0) {
             $title = api_strtoupper(get_lang('Average')) . '<br />' . get_lang('Detailed');
         } else {
             $title = api_strtoupper(get_lang('Average')) . '<br />' . $cat[0]->get_description() . ' - (' . $cat[0]->get_name() . ')';
         }
     } else {
         if ($parent_id == 0) {
             $title = api_strtoupper(get_lang('Average')) . '<br />' . get_lang('Detailed');
         } else {
             $title = api_strtoupper(get_lang('Average'));
         }
     }
     $columns = count($printable_data[0]);
     $has_data = is_array($printable_data[1]) && count($printable_data[1]) > 0;
     $table = new HTML_Table(array('class' => 'data_table'));
     $row = 0;
     $column = 0;
     $table->setHeaderContents($row, $column, get_lang('NumberAbbreviation'));
     $column++;
     foreach ($printable_data[0] as $printable_data_cell) {
         if (!is_array($printable_data_cell)) {
             $printable_data_cell = strip_tags($printable_data_cell);
         }
         $table->setHeaderContents($row, $column, $printable_data_cell);
         $column++;
     }
     $row++;
     if ($has_data) {
         $counter = 1;
         foreach ($printable_data[1] as &$printable_data_row) {
             $column = 0;
             $table->setCellContents($row, $column, $counter);
             $table->updateCellAttributes($row, $column, 'align="center"');
             $column++;
             $counter++;
             foreach ($printable_data_row as $key => &$printable_data_cell) {
                 $attributes = array();
                 $attributes['align'] = 'center';
                 $attributes['style'] = null;
                 if ($key === 'name') {
                     $attributes['align'] = 'left';
                 }
                 if ($key === 'total') {
                     $attributes['style'] = 'font-weight:bold';
                 }
                 $table->setCellContents($row, $column, $printable_data_cell);
                 $table->updateCellAttributes($row, $column, $attributes);
                 $column++;
             }
             $table->updateRowAttributes($row, $row % 2 ? 'class="row_even"' : 'class="row_odd"', true);
             $row++;
         }
     } else {
         $column = 0;
         $table->setCellContents($row, $column, get_lang('NoResults'));
         $table->updateCellAttributes($row, $column, 'colspan="' . $columns . '" align="center" class="row_odd"');
     }
     $pdfParams = array('filename' => get_lang('FlatView') . '_' . api_get_utc_datetime(), 'pdf_title' => $title, 'course_code' => $course_code, 'add_signatures' => true);
     $page_format = $params['orientation'] == 'landscape' ? 'A4-L' : 'A4';
     $pdf = new PDF($page_format, $page_format, $pdfParams);
     $pdf->html_to_pdf_with_template($flatviewtable->return_table());
     exit;
 }
コード例 #17
0
 /**
  * @param array $data
  * @param array $params
  *
  * @return string
  */
 public static function convert_array_to_html($data, $params = array())
 {
     $headers = $data[0];
     unset($data[0]);
     $header_attributes = isset($params['header_attributes']) ? $params['header_attributes'] : array();
     $table = new HTML_Table(array('class' => 'data_table', 'repeat_header' => '1'));
     $row = 0;
     $column = 0;
     foreach ($headers as $header) {
         $table->setHeaderContents($row, $column, $header);
         $attributes = array();
         if (isset($header_attributes) && isset($header_attributes[$column])) {
             $attributes = $header_attributes[$column];
         }
         if (!empty($attributes)) {
             $table->updateCellAttributes($row, $column, $attributes);
         }
         $column++;
     }
     $row++;
     foreach ($data as &$printable_data_row) {
         $column = 0;
         foreach ($printable_data_row as &$printable_data_cell) {
             $table->setCellContents($row, $column, $printable_data_cell);
             //$table->updateCellAttributes($row, $column, $atributes);
             $column++;
         }
         $table->updateRowAttributes($row, $row % 2 ? 'class="row_even"' : 'class="row_odd"', true);
         $row++;
     }
     $table_tp_html = $table->toHtml();
     return $table_tp_html;
 }
コード例 #18
0
 /**
  * Muestra el formulario para editar un período existente.
  */
 private function imprimirFormularioEditarPeriodo()
 {
     $periodo = $this->gestorPeriodos->getPeriodo($_REQUEST['idPeriodoEditar']);
     imprimirTabulados(5);
     echo '<div class="tablaTituloBotones">';
     imprimirTabulados(6);
     echo '<h1>Editar</h1>';
     imprimirTabulados(6);
     echo '<form action="periodos.php" method="post">';
     imprimirTabulados(6);
     echo '<fieldset>';
     imprimirTabulados(6);
     $clase = array('class' => 'tablaCarga');
     $tabla = new HTML_Table($clase);
     $tabla->setAutoGrow(true);
     $tabla->setHeaderContents(0, 0, 'Nombre');
     $tabla->setCellContents(0, 1, '<input class="campoTexto campoTextoAlineado" type="text" name="nombre" value="' . $periodo->getNombre() . '" />');
     $tabla->setHeaderContents(1, 0, 'Fecha de inicio');
     $tabla->setCellContents(1, 1, $periodo->imprimirInicio());
     $tabla->setHeaderContents(2, 0, 'Fecha de fin');
     $tabla->setCellContents(2, 1, $periodo->imprimirFin());
     $tabla->setHeaderContents(3, 0, 'Área');
     $tabla->setCellContents(3, 1, $periodo->getArea()->getNombreArea());
     $tabla->setHeaderContents(4, 0, 'Observaciones');
     $tabla->setCellContents(4, 1, '<textarea name="observaciones" rows="4" cols="20">' . $periodo->getObservaciones() . '</textarea>');
     $tabla->setColAttributes(0, $clase);
     $tabla->setColAttributes(1, $clase);
     echo $tabla->toHtml();
     imprimirTabulados(6);
     echo '<input type="hidden" name="idPeriodoEditar"  value="' . $periodo->getIdPeriodo() . '" />';
     imprimirTabulados(6);
     echo '<br /><input type="submit" name="enviarEditarPeriodo"  value="Enviar" >';
     imprimirTabulados(6);
     echo '</fieldset>';
     imprimirTabulados(6);
     echo '</form>';
     imprimirTabulados(5);
     echo '</div>';
 }
コード例 #19
0
ファイル: user_list.php プロジェクト: KRCM13/chamilo-lms
                if (!empty($access_info)) {
                    foreach ($access_info as $url_info) {
                        if ($current_access_url_id == $url_info['access_url_id']) {
                            $add_user = false;
                        }
                        $access_info_to_string .= $url_info['url'] . '<br />';
                    }
                }
                if ($add_user) {
                    $row_table = array();
                    $row_table[] = api_get_person_name($user['firstname'], $user['lastname']) . ' (' . $user['username'] . ') ';
                    $row_table[] = $access_info_to_string;
                    $url = api_get_self() . '?action=add_user_to_my_url&user_id=' . $user['id'] . '&sec_token=' . $_SESSION['sec_token'];
                    $row_table[] = Display::url(get_lang('AddUserToMyURL'), $url, array('class' => 'btn'));
                    foreach ($row_table as $cell) {
                        $table->setCellContents($row, $column, $cell);
                        $table->updateCellAttributes($row, $column, 'align="center"');
                        $column++;
                    }
                    $table->updateRowAttributes($row, $row % 2 ? 'class="row_even"' : 'class="row_odd"', true);
                    $row++;
                }
            }
            $extra_search_options .= $table->toHtml();
            $table_result = '';
        }
    }
}
$tpl = new Template($tool_name);
$tpl->assign('actions', $actions);
$tpl->assign('message', $message);
コード例 #20
0
$row++;
$form = new FormValidator('workflow', 'post', api_get_self() . '?' . $params);
$options = api_get_user_roles();
$options[0] = get_lang('SelectAnOption');
ksort($options);
$form->addElement('select', 'status', get_lang('SelectRole'), $options, array('onclick' => 'changeStatus(this)'));
$checks = $app['orm.em']->getRepository('Entity\\ExtraFieldOptionRelFieldOption')->findBy(array('fieldId' => $field_id, 'roleId' => $roleId));
$includedFields = array();
if (!empty($checks)) {
    foreach ($checks as $availableField) {
        $includedFields[$availableField->getFieldOptionId()][] = $availableField->getRelatedFieldOptionId();
    }
}
foreach ($result as $item) {
    $column = 0;
    $table->setCellContents($row, $column, $item['option_display_text']);
    $column++;
    $value = null;
    foreach ($result as $itemCol) {
        $id = 'extra_field_status_' . $item['id'] . '_' . $itemCol['id'];
        $idForm = 'extra_field_status[' . $item['id'] . '][' . $itemCol['id'] . ']';
        $attributes = array('onclick' => 'setHidden(this)');
        $value = 0;
        if (isset($includedFields[$itemCol['id']]) && in_array($item['id'], $includedFields[$itemCol['id']])) {
            $value = 1;
            $attributes['checked'] = 'checked';
        }
        $element = Display::input('checkbox', $id, null, $attributes);
        $table->setCellContents($row, $column, $element);
        $form->addElement('hidden', 'hidden_' . $idForm, $value, array('id' => 'hidden_' . $id));
        $column++;
コード例 #21
0
    /**
     * @param FormValidator $form
     * @param array $extraData
     * @param string $form_name
     * @param bool $admin_permissions
     * @param int $user_id
     * @param array $extra
     * @param int $itemId
     *
     * @return array
     */
    public function set_extra_fields_in_form($form, $extraData, $form_name, $admin_permissions = false, $user_id = null, $extra = array(), $itemId = null)
    {
        $user_id = intval($user_id);
        $type = $this->type;
        // User extra fields
        if ($type == 'user') {
            $extra = UserManager::get_extra_fields(0, 50, 5, 'ASC', true, null, true);
        }
        $jquery_ready_content = null;
        if (!empty($extra)) {
            foreach ($extra as $field_details) {
                // Getting default value id if is set
                $defaultValueId = null;
                if (isset($field_details['options']) && !empty($field_details['options'])) {
                    $valueToFind = null;
                    if (isset($field_details['field_default_value'])) {
                        $valueToFind = $field_details['field_default_value'];
                    }
                    // If a value is found we override the default value
                    if (isset($extraData['extra_' . $field_details['field_variable']])) {
                        $valueToFind = $extraData['extra_' . $field_details['field_variable']];
                    }
                    foreach ($field_details['options'] as $option) {
                        if ($option['option_value'] == $valueToFind) {
                            $defaultValueId = $option['id'];
                        }
                    }
                }
                if (!$admin_permissions) {
                    if ($field_details['field_visible'] == 0) {
                        continue;
                    }
                }
                switch ($field_details['field_type']) {
                    case ExtraField::FIELD_TYPE_TEXT:
                        $form->addElement('text', 'extra_' . $field_details['field_variable'], $field_details['field_display_text'], array('class' => 'span4'));
                        $form->applyFilter('extra_' . $field_details['field_variable'], 'stripslashes');
                        $form->applyFilter('extra_' . $field_details['field_variable'], 'trim');
                        if (!$admin_permissions) {
                            if ($field_details['field_visible'] == 0) {
                                $form->freeze('extra_' . $field_details['field_variable']);
                            }
                        }
                        break;
                    case ExtraField::FIELD_TYPE_TEXTAREA:
                        $form->add_html_editor('extra_' . $field_details['field_variable'], $field_details['field_display_text'], false, false, array('ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130'));
                        $form->applyFilter('extra_' . $field_details['field_variable'], 'stripslashes');
                        $form->applyFilter('extra_' . $field_details['field_variable'], 'trim');
                        if (!$admin_permissions) {
                            if ($field_details['field_visible'] == 0) {
                                $form->freeze('extra_' . $field_details['field_variable']);
                            }
                        }
                        break;
                    case ExtraField::FIELD_TYPE_RADIO:
                        $group = array();
                        if (isset($field_details['options']) && !empty($field_details['options'])) {
                            foreach ($field_details['options'] as $option_details) {
                                $options[$option_details['option_value']] = $option_details['option_display_text'];
                                $group[] = $form->createElement('radio', 'extra_' . $field_details['field_variable'], $option_details['option_value'], $option_details['option_display_text'] . '<br />', $option_details['option_value']);
                            }
                        }
                        $form->addGroup($group, 'extra_' . $field_details['field_variable'], $field_details['field_display_text'], '');
                        if (!$admin_permissions) {
                            if ($field_details['field_visible'] == 0) {
                                $form->freeze('extra_' . $field_details['field_variable']);
                            }
                        }
                        break;
                    case ExtraField::FIELD_TYPE_CHECKBOX:
                        $group = array();
                        if (isset($field_details['options']) && !empty($field_details['options'])) {
                            foreach ($field_details['options'] as $option_details) {
                                $options[$option_details['option_value']] = $option_details['option_display_text'];
                                $group[] = $form->createElement('checkbox', 'extra_' . $field_details['field_variable'], $option_details['option_value'], $option_details['option_display_text'] . '<br />', $option_details['option_value']);
                            }
                        } else {
                            // We assume that is a switch on/off with 1 and 0 as values
                            $group[] = $form->createElement('checkbox', 'extra_' . $field_details['field_variable'], null, 'Yes <br />', null);
                        }
                        $form->addGroup($group, 'extra_' . $field_details['field_variable'], $field_details['field_display_text'], '');
                        if (!$admin_permissions) {
                            if ($field_details['field_visible'] == 0) {
                                $form->freeze('extra_' . $field_details['field_variable']);
                            }
                        }
                        break;
                    case ExtraField::FIELD_TYPE_SELECT:
                        $get_lang_variables = false;
                        if (in_array($field_details['field_variable'], array('mail_notify_message', 'mail_notify_invitation', 'mail_notify_group_message'))) {
                            $get_lang_variables = true;
                        }
                        // Get extra field workflow
                        $userInfo = api_get_user_info();
                        $addOptions = array();
                        $optionsExists = Database::getManager()->getRepository('ChamiloCoreBundle:ExtraFieldOptionRelFieldOption')->findOneBy(array('fieldId' => $field_details['id']));
                        if ($optionsExists) {
                            if (isset($userInfo['status']) && !empty($userInfo['status'])) {
                                $fieldWorkFlow = Database::getManager()->getRepository('ChamiloCoreBundle:ExtraFieldOptionRelFieldOption')->findBy(array('fieldId' => $field_details['id'], 'relatedFieldOptionId' => $defaultValueId, 'roleId' => $userInfo['status']));
                                foreach ($fieldWorkFlow as $item) {
                                    $addOptions[] = $item->getFieldOptionId();
                                }
                            }
                        }
                        $options = array();
                        if (empty($defaultValueId)) {
                            $options[''] = get_lang('SelectAnOption');
                        }
                        $optionList = array();
                        if (!empty($field_details['options'])) {
                            foreach ($field_details['options'] as $option_details) {
                                $optionList[$option_details['id']] = $option_details;
                                if ($get_lang_variables) {
                                    $options[$option_details['option_value']] = get_lang($option_details['option_display_text']);
                                } else {
                                    if ($optionsExists) {
                                        // Adding always the default value
                                        if ($option_details['id'] == $defaultValueId) {
                                            $options[$option_details['option_value']] = $option_details['option_display_text'];
                                        } else {
                                            if (isset($addOptions) && !empty($addOptions)) {
                                                // Parsing filters
                                                if (in_array($option_details['id'], $addOptions)) {
                                                    $options[$option_details['option_value']] = $option_details['option_display_text'];
                                                }
                                            }
                                        }
                                    } else {
                                        // Normal behaviour
                                        $options[$option_details['option_value']] = $option_details['option_display_text'];
                                    }
                                }
                            }
                            if (isset($optionList[$defaultValueId])) {
                                if (isset($optionList[$defaultValueId]['option_value']) && $optionList[$defaultValueId]['option_value'] == 'aprobada') {
                                    if (api_is_question_manager() == false) {
                                        $form->freeze();
                                    }
                                }
                            }
                            // Setting priority message
                            if (isset($optionList[$defaultValueId]) && isset($optionList[$defaultValueId]['priority'])) {
                                if (!empty($optionList[$defaultValueId]['priority'])) {
                                    $priorityId = $optionList[$defaultValueId]['priority'];
                                    $option = new ExtraFieldOption($this->type);
                                    $messageType = $option->getPriorityMessageType($priorityId);
                                    $form->addElement('label', null, Display::return_message($optionList[$defaultValueId]['priority_message'], $messageType));
                                }
                            }
                        }
                        if ($get_lang_variables) {
                            $field_details['field_display_text'] = get_lang($field_details['field_display_text']);
                        }
                        // chzn-select doesn't work for sessions??
                        $form->addElement('select', 'extra_' . $field_details['field_variable'], $field_details['field_display_text'], $options, array('id' => 'extra_' . $field_details['field_variable']));
                        if ($optionsExists && $field_details['field_loggeable'] && !empty($defaultValueId)) {
                            $form->addElement('textarea', 'extra_' . $field_details['field_variable'] . '_comment', $field_details['field_display_text'] . ' ' . get_lang('Comment'));
                            $em = Database::getManager();
                            $extraFieldValue = new ExtraFieldValue($this->type);
                            $repo = $em->getRepository($extraFieldValue->entityName);
                            $repoLog = $em->getRepository('Gedmo\\Loggable\\Entity\\LogEntry');
                            $newEntity = $repo->findOneBy(array($this->handlerEntityId => $itemId, 'fieldId' => $field_details['id']));
                            // @todo move this in a function inside the class
                            if ($newEntity) {
                                $logs = $repoLog->getLogEntries($newEntity);
                                if (!empty($logs)) {
                                    $html = '<b>' . get_lang('LatestChanges') . '</b><br /><br />';
                                    $table = new HTML_Table(array('class' => 'data_table'));
                                    $table->setHeaderContents(0, 0, get_lang('Value'));
                                    $table->setHeaderContents(0, 1, get_lang('Comment'));
                                    $table->setHeaderContents(0, 2, get_lang('ModifyDate'));
                                    $table->setHeaderContents(0, 3, get_lang('Username'));
                                    $row = 1;
                                    foreach ($logs as $log) {
                                        $column = 0;
                                        $data = $log->getData();
                                        $fieldValue = isset($data['fieldValue']) ? $data['fieldValue'] : null;
                                        $comment = isset($data['comment']) ? $data['comment'] : null;
                                        $table->setCellContents($row, $column, $fieldValue);
                                        $column++;
                                        $table->setCellContents($row, $column, $comment);
                                        $column++;
                                        $table->setCellContents($row, $column, api_get_local_time($log->getLoggedAt()->format('Y-m-d H:i:s')));
                                        $column++;
                                        $table->setCellContents($row, $column, $log->getUsername());
                                        $row++;
                                    }
                                    $form->addElement('label', null, $html . $table->toHtml());
                                }
                            }
                        }
                        if (!$admin_permissions) {
                            if ($field_details['field_visible'] == 0) {
                                $form->freeze('extra_' . $field_details['field_variable']);
                            }
                        }
                        break;
                    case ExtraField::FIELD_TYPE_SELECT_MULTIPLE:
                        $options = array();
                        foreach ($field_details['options'] as $option_id => $option_details) {
                            $options[$option_details['option_value']] = $option_details['option_display_text'];
                        }
                        $form->addElement('select', 'extra_' . $field_details['field_variable'], $field_details['field_display_text'], $options, array('multiple' => 'multiple'));
                        if (!$admin_permissions) {
                            if ($field_details['field_visible'] == 0) {
                                $form->freeze('extra_' . $field_details['field_variable']);
                            }
                        }
                        break;
                    case ExtraField::FIELD_TYPE_DATE:
                        $form->addElement('datepickerdate', 'extra_' . $field_details['field_variable'], $field_details['field_display_text'], array('form_name' => $form_name));
                        $form->_elements[$form->_elementIndex['extra_' . $field_details['field_variable']]]->setLocalOption('minYear', 1900);
                        $defaults['extra_' . $field_details['field_variable']] = date('Y-m-d 12:00:00');
                        if (!isset($form->_defaultValues['extra_' . $field_details['field_variable']])) {
                            $form->setDefaults($defaults);
                        }
                        if (!$admin_permissions) {
                            if ($field_details['field_visible'] == 0) {
                                $form->freeze('extra_' . $field_details['field_variable']);
                            }
                        }
                        $form->applyFilter('theme', 'trim');
                        break;
                    case ExtraField::FIELD_TYPE_DATETIME:
                        $form->addElement('datepicker', 'extra_' . $field_details['field_variable'], $field_details['field_display_text'], array('form_name' => $form_name));
                        $form->_elements[$form->_elementIndex['extra_' . $field_details['field_variable']]]->setLocalOption('minYear', 1900);
                        $defaults['extra_' . $field_details['field_variable']] = date('Y-m-d 12:00:00');
                        if (!isset($form->_defaultValues['extra_' . $field_details['field_variable']])) {
                            $form->setDefaults($defaults);
                        }
                        if (!$admin_permissions) {
                            if ($field_details['field_visible'] == 0) {
                                $form->freeze('extra_' . $field_details['field_variable']);
                            }
                        }
                        $form->applyFilter('theme', 'trim');
                        break;
                    case ExtraField::FIELD_TYPE_DOUBLE_SELECT:
                        $first_select_id = 'first_extra_' . $field_details['field_variable'];
                        $url = api_get_path(WEB_AJAX_PATH) . 'extra_field.ajax.php?1=1';
                        $jquery_ready_content .= '
                        $("#' . $first_select_id . '").on("change", function() {
                            var id = $(this).val();
                            if (id) {
                                $.ajax({
                                    url: "' . $url . '&a=get_second_select_options",
                                    dataType: "json",
                                    data: "type=' . $type . '&field_id=' . $field_details['id'] . '&option_value_id="+id,
                                    success: function(data) {
                                        $("#second_extra_' . $field_details['field_variable'] . '").empty();
                                        $.each(data, function(index, value) {
                                            $("#second_extra_' . $field_details['field_variable'] . '").append($("<option/>", {
                                                value: index,
                                                text: value
                                            }));
                                        });
                                    },
                                });
                            } else {
                                $("#second_extra_' . $field_details['field_variable'] . '").empty();
                            }
                        });';
                        $first_id = null;
                        $second_id = null;
                        if (!empty($extraData)) {
                            $first_id = $extraData['extra_' . $field_details['field_variable']]['extra_' . $field_details['field_variable']];
                            $second_id = $extraData['extra_' . $field_details['field_variable']]['extra_' . $field_details['field_variable'] . '_second'];
                        }
                        $options = ExtraField::extra_field_double_select_convert_array_to_ordered_array($field_details['options']);
                        $values = array('' => get_lang('Select'));
                        $second_values = array();
                        if (!empty($options)) {
                            foreach ($options as $option) {
                                foreach ($option as $sub_option) {
                                    if ($sub_option['option_value'] == '0') {
                                        $values[$sub_option['id']] = $sub_option['option_display_text'];
                                    } else {
                                        if ($first_id === $sub_option['option_value']) {
                                            $second_values[$sub_option['id']] = $sub_option['option_display_text'];
                                        }
                                    }
                                }
                            }
                        }
                        $group = array();
                        $group[] = $form->createElement('select', 'extra_' . $field_details['field_variable'], null, $values, array('id' => $first_select_id));
                        $group[] = $form->createElement('select', 'extra_' . $field_details['field_variable'] . '_second', null, $second_values, array('id' => 'second_extra_' . $field_details['field_variable']));
                        $form->addGroup($group, 'extra_' . $field_details['field_variable'], $field_details['field_display_text'], '&nbsp;');
                        if (!$admin_permissions) {
                            if ($field_details['field_visible'] == 0) {
                                $form->freeze('extra_' . $field_details['field_variable']);
                            }
                        }
                        break;
                    case ExtraField::FIELD_TYPE_DIVIDER:
                        $form->addElement('static', $field_details['field_variable'], '<br /><strong>' . $field_details['field_display_text'] . '</strong>');
                        break;
                    case ExtraField::FIELD_TYPE_TAG:
                        $field_variable = $field_details['field_variable'];
                        $field_id = $field_details['id'];
                        if ($this->type == 'user') {
                            // The magic should be here
                            $user_tags = UserManager::get_user_tags($user_id, $field_details['id']);
                            $tag_list = '';
                            if (is_array($user_tags) && count($user_tags) > 0) {
                                foreach ($user_tags as $tag) {
                                    $tag_list .= '<option value="' . $tag['tag'] . '" class="selected">' . $tag['tag'] . '</option>';
                                }
                            }
                            $url = api_get_path(WEB_AJAX_PATH) . 'user_manager.ajax.php?';
                        } else {
                            $extraFieldValue = new ExtraFieldValue($this->type);
                            $tags = array();
                            if (!empty($itemId)) {
                                $tags = $extraFieldValue->getAllValuesByItemAndField($itemId, $field_id);
                            }
                            $tag_list = '';
                            if (is_array($tags) && count($tags) > 0) {
                                $extraFieldOption = new ExtraFieldOption($this->type);
                                foreach ($tags as $tag) {
                                    $option = $extraFieldOption->get($tag['field_value']);
                                    $tag_list .= '<option value="' . $option['id'] . '" class="selected">' . $option['option_display_text'] . '</option>';
                                }
                            }
                            $url = api_get_path(WEB_AJAX_PATH) . 'extra_field.ajax.php';
                        }
                        $form->addElement('hidden', 'extra_' . $field_details['field_variable'] . '__persist__', 1);
                        $multiSelect = '<select id="extra_' . $field_details['field_variable'] . '" name="extra_' . $field_details['field_variable'] . '">
                                        ' . $tag_list . '
                                        </select>';
                        $form->addElement('label', $field_details['field_display_text'], $multiSelect);
                        $complete_text = get_lang('StartToType');
                        //if cache is set to true the jquery will be called 1 time
                        $jquery_ready_content .= <<<EOF
                    \$("#extra_{$field_variable}").fcbkcomplete({
                        json_url: "{$url}?a=search_tags&field_id={$field_id}&type={$this->type}",
                        cache: false,
                        filter_case: true,
                        filter_hide: true,
                        complete_text:"{$complete_text}",
                        firstselected: false,
                        filter_selected: true,
                        newel: true
                    });
EOF;
                        $jquery_ready_content = null;
                        break;
                    case ExtraField::FIELD_TYPE_TIMEZONE:
                        $form->addElement('select', 'extra_' . $field_details['field_variable'], $field_details['field_display_text'], api_get_timezones(), '');
                        if ($field_details['field_visible'] == 0) {
                            $form->freeze('extra_' . $field_details['field_variable']);
                        }
                        break;
                    case ExtraField::FIELD_TYPE_SOCIAL_PROFILE:
                        // get the social network's favicon
                        $icon_path = UserManager::get_favicon_from_url($extraData['extra_' . $field_details['field_variable']], $field_details['field_default_value']);
                        // special hack for hi5
                        $leftpad = '1.7';
                        $top = '0.4';
                        $domain = parse_url($icon_path, PHP_URL_HOST);
                        if ($domain == 'www.hi5.com' or $domain == 'hi5.com') {
                            $leftpad = '3';
                            $top = '0';
                        }
                        // print the input field
                        $form->addElement('text', 'extra_' . $field_details['field_variable'], $field_details['field_display_text'], array('size' => 60, 'style' => 'background-image: url(\'' . $icon_path . '\'); background-repeat: no-repeat; background-position: 0.4em ' . $top . 'em; padding-left: ' . $leftpad . 'em; '));
                        $form->applyFilter('extra_' . $field_details['field_variable'], 'stripslashes');
                        $form->applyFilter('extra_' . $field_details['field_variable'], 'trim');
                        if ($field_details['field_visible'] == 0) {
                            $form->freeze('extra_' . $field_details['field_variable']);
                        }
                        break;
                }
            }
        }
        $return = array();
        $return['jquery_ready_content'] = $jquery_ready_content;
        return $return;
    }
コード例 #22
0
ファイル: index.php プロジェクト: Rem122/Uthando-CMS
<?php

// no direct access
defined('PARENT_FILE') or die('Restricted access');
if (is_readable($this->file . "/action/" . $this->registry->action . ".php") == false || $this->registry->action == "index") {
    $this->registry->Error('404 Page NOT Found', $this->registry->path);
} else {
    $title = ucwords(str_replace("_", " ", $this->registry->action));
    $this->registry->page_title = $title;
    $this->setTitle($title . ' | ' . $this->get('config.server.site_name'));
    $table_attrs = array('class' => 'contentpaneopen');
    $rowAttrs = array('class' => 'contentheading', 'width' => '100%');
    $table = new HTML_Table($table_attrs);
    $table->setCellContents(0, 0, $this->registry->page_title);
    $table->setColAttributes(0, $rowAttrs);
    $this->addContent($table->toHTML());
    require_once 'action/' . $this->registry->action . '.php';
}
コード例 #23
0
    }
    $table->setCellContents($row, 0, $label . $item);
    $csvContent[] = array($label, strip_tags($item));
    $row++;
}
$userInformation = $table->toHtml();
$table = new HTML_Table(array('class' => 'data_table'));
$table->setHeaderContents(0, 0, get_lang('Tracking'));
$csvContent[] = get_lang('Tracking');
$data = array(get_lang('FirstLogin') => Tracking::get_first_connection_date($user['user_id']), get_lang('LatestLogin') => Tracking::get_last_connection_date($user['user_id'], true));
$row = 1;
foreach ($data as $label => $item) {
    if (!empty($label)) {
        $label = $label . ': ';
    }
    $table->setCellContents($row, 0, $label . $item);
    $csvContent[] = array($label, strip_tags($item));
    $row++;
}
$trackingInformation = $table->toHtml();
$tbl_session_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
$tbl_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
$tbl_user = Database::get_main_table(TABLE_MAIN_USER);
$user_id = $user['user_id'];
$sessions = SessionManager::get_sessions_by_user($user_id, true);
$personal_course_list = array();
$courseToolInformationTotal = null;
if (count($sessions) > 0) {
    $sessionInformation = null;
コード例 #24
0
 /**
  * Gets the html content to show in the 3 column view
  */
 public static function show_tool_3column($cat)
 {
     global $_user;
     $TBL_ACCUEIL = Database::get_course_table(TABLE_TOOL_LIST);
     $TABLE_TOOLS = Database::get_main_table(TABLE_MAIN_COURSE_MODULE);
     $numcols = 3;
     $table = new HTML_Table('width="100%"');
     $all_tools = array();
     $course_id = api_get_course_int_id();
     switch ($cat) {
         case 'Basic':
             $condition_display_tools = ' WHERE a.c_id = ' . $course_id . ' AND  a.link=t.link AND t.position="basic" ';
             if ((api_is_coach() || api_is_course_tutor()) && $_SESSION['studentview'] != 'studentview') {
                 $condition_display_tools = ' WHERE a.c_id = ' . $course_id . ' AND a.link=t.link AND (t.position="basic" OR a.name = "' . TOOL_TRACKING . '") ';
             }
             $sql = "SELECT a.*, t.image img, t.row, t.column  FROM {$TBL_ACCUEIL} a, {$TABLE_TOOLS} t\n                        {$condition_display_tools} ORDER BY t.row, t.column";
             break;
         case 'External':
             if (api_is_allowed_to_edit()) {
                 $sql = "SELECT a.*, t.image img FROM {$TBL_ACCUEIL} a, {$TABLE_TOOLS} t\n                            WHERE a.c_id = {$course_id} AND ((a.link=t.link AND t.position='external')\n                            OR (a.visibility <= 1 AND (a.image = 'external.gif' OR a.image = 'scormbuilder.gif' OR t.image = 'blog.gif') AND a.image=t.image))\n                            ORDER BY a.id";
             } else {
                 $sql = "SELECT a.*, t.image img FROM {$TBL_ACCUEIL} a, {$TABLE_TOOLS} t\n                            WHERE a.c_id = {$course_id} AND (a.visibility = 1 AND ((a.link=t.link AND t.position='external')\n                            OR ((a.image = 'external.gif' OR a.image = 'scormbuilder.gif' OR t.image = 'blog.gif') AND a.image=t.image)))\n                            ORDER BY a.id";
             }
             break;
         case 'courseAdmin':
             $sql = "SELECT a.*, t.image img, t.row, t.column  FROM {$TBL_ACCUEIL} a, {$TABLE_TOOLS} t\n                        WHERE a.c_id = {$course_id} AND admin=1 AND a.link=t.link ORDER BY t.row, t.column";
             break;
         case 'platformAdmin':
             $sql = "SELECT *, image img FROM {$TBL_ACCUEIL} WHERE c_id = {$course_id} AND visibility = 2 ORDER BY id";
     }
     $result = Database::query($sql);
     // Grabbing all the tools from $course_tool_table
     while ($tool = Database::fetch_array($result)) {
         $all_tools[] = $tool;
     }
     $course_id = api_get_course_int_id();
     // Grabbing all the links that have the property on_homepage set to 1
     if ($cat == 'External') {
         $tbl_link = Database::get_course_table(TABLE_LINK);
         $tbl_item_property = Database::get_course_table(TABLE_ITEM_PROPERTY);
         if (api_is_allowed_to_edit(null, true)) {
             $sql_links = "SELECT tl.*, tip.visibility\n\t\t\t\t\t\t\t\tFROM {$tbl_link} tl\n                                LEFT JOIN {$tbl_item_property} tip ON tip.tool='link' AND tip.ref=tl.id\n                                WHERE \ttl.c_id = {$course_id} AND\n                                \t\ttip.c_id = {$course_id} AND\n                \t\t\t\t\t\ttl.on_homepage='1' AND\n                \t\t\t\t\t\ttip.visibility != 2";
         } else {
             $sql_links = "SELECT tl.*, tip.visibility\n                                    FROM {$tbl_link} tl\n                                    LEFT JOIN {$tbl_item_property} tip ON tip.tool='link' AND tip.ref=tl.id\n                                    WHERE \ttl.c_id = {$course_id} AND\n                                \t\t\ttip.c_id = {$course_id} AND\n                \t\t\t\t\t\t\ttl.on_homepage='1' AND\n                \t\t\t\t\t\t\ttip.visibility = 1";
         }
         $result_links = Database::query($sql_links);
         while ($links_row = Database::fetch_array($result_links)) {
             $properties = array();
             $properties['name'] = $links_row['title'];
             $properties['link'] = $links_row['url'];
             $properties['visibility'] = $links_row['visibility'];
             $properties['img'] = 'external.gif';
             $properties['adminlink'] = api_get_path(WEB_CODE_PATH) . 'link/link.php?action=editlink&amp;id=' . $links_row['id'];
             $all_tools[] = $properties;
         }
     }
     $cell_number = 0;
     // Draw line between basic and external, only if there are entries in External
     if ($cat == 'External' && count($all_tools)) {
         $table->setCellContents(0, 0, '<hr noshade="noshade" size="1"/>');
         $table->updateCellAttributes(0, 0, 'colspan="3"');
         $cell_number += $numcols;
     }
     foreach ($all_tools as &$tool) {
         if ($tool['image'] == 'scormbuilder.gif') {
             // check if the published learnpath is visible for student
             $published_lp_id = self::get_published_lp_id_from_link($tool['link']);
             if (!api_is_allowed_to_edit(null, true) && !learnpath::is_lp_visible_for_student($published_lp_id, api_get_user_id(), api_get_course_id(), api_get_session_id())) {
                 continue;
             }
         }
         if (api_get_session_id() != 0 && in_array($tool['name'], array('course_maintenance', 'course_setting'))) {
             continue;
         }
         $cell_content = '';
         // The name of the tool
         $tool_name = self::translate_tool_name($tool);
         $link_annex = '';
         // The url of the tool
         if ($tool['img'] != 'external.gif') {
             $tool['link'] = api_get_path(WEB_CODE_PATH) . $tool['link'];
             $qm_or_amp = strpos($tool['link'], '?') === false ? '?' : '&amp;';
             $link_annex = $qm_or_amp . api_get_cidreq();
         } else {
             // If an external link ends with 'login='******'link'], '?login='******'link'], '&amp;login='******'username'];
             }
         }
         // Setting the actual image url
         $tool['img'] = api_get_path(WEB_IMG_PATH) . $tool['img'];
         // VISIBLE
         if ($tool['visibility'] || (api_is_coach() || api_is_course_tutor()) && $tool['name'] == TOOL_TRACKING || $cat == 'courseAdmin' || $cat == 'platformAdmin') {
             if (strpos($tool['name'], 'visio_') !== false) {
                 $cell_content .= '<a  href="javascript: void(0);" onclick="javascript: window.open(\'' . $tool['link'] . $link_annex . '\',\'window_visio' . $_SESSION['_cid'] . '\',config=\'height=\'+730+\', width=\'+1020+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')" target="' . $tool['target'] . '"><img src="' . $tool['img'] . '" title="' . $tool_name . '" alt="' . $tool_name . '" align="absmiddle" border="0">' . $tool_name . '</a>';
             } elseif (strpos($tool['name'], 'chat') !== false && api_get_course_setting('allow_open_chat_window')) {
                 $cell_content .= '<a href="javascript: void(0);" onclick="javascript: window.open(\'' . $tool['link'] . $link_annex . '\',\'window_chat' . $_SESSION['_cid'] . '\',config=\'height=\'+600+\', width=\'+825+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')" target="' . $tool['target'] . '"><img src="' . $tool['img'] . '" title="' . $tool_name . '" alt="' . $tool_name . '" align="absmiddle" border="0">' . $tool_name . '</a>';
                 // don't replace img with display::return_icon because $tool['img'] = api_get_path(WEB_IMG_PATH).$tool['img']
             } else {
                 $cell_content .= '<a href="' . $tool['link'] . $link_annex . '" target="' . $tool['target'] . '"><img src="' . $tool['img'] . '" title="' . $tool_name . '" alt="' . $tool_name . '" align="absmiddle" border="0">' . $tool_name . '</a>';
                 // don't replace img with display::return_icon because $tool['img'] = api_get_path(WEB_IMG_PATH).$tool['img']
             }
         } else {
             // INVISIBLE
             if (api_is_allowed_to_edit(null, true)) {
                 if (strpos($tool['name'], 'visio_') !== false) {
                     $cell_content .= '<a  href="javascript: void(0);" onclick="window.open(\'' . $tool['link'] . $link_annex . '\',\'window_visio' . $_SESSION['_cid'] . '\',config=\'height=\'+730+\', width=\'+1020+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')" target="' . $tool['target'] . '"><img src="' . str_replace(".gif", "_na.gif", $tool['img']) . '" title="' . $tool_name . '" alt="' . $tool_name . '" align="absmiddle" border="0">' . $tool_name . '</a>';
                 } elseif (strpos($tool['name'], 'chat') !== false && api_get_course_setting('allow_open_chat_window')) {
                     $cell_content .= '<a href="javascript: void(0);" onclick="javascript: window.open(\'' . $tool['link'] . $link_annex . '\',\'window_chat' . $_SESSION['_cid'] . '\',config=\'height=\'+600+\', width=\'+825+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')" target="' . $tool['target'] . '" class="invisible"><img src="' . str_replace(".gif", "_na.gif", $tool['img']) . '" title="' . $tool_name . '" alt="' . $tool_name . '" align="absmiddle" border="0">' . $tool_name . '</a>';
                     // don't replace img with display::return_icon because $tool['img'] = api_get_path(WEB_IMG_PATH).$tool['img']
                 } else {
                     $cell_content .= '<a href="' . $tool['link'] . $link_annex . '" target="' . $tool['target'] . '" class="invisible">
                                         <img src="' . str_replace(".gif", "_na.gif", $tool['img']) . '" title="' . $tool_name . '" alt="' . $tool_name . '" align="absmiddle" border="0">' . $tool_name . '</a>';
                     // don't replace img with display::return_icon because $tool['img'] = api_get_path(WEB_IMG_PATH).$tool['img']
                 }
             } else {
                 $cell_content .= '<img src="' . str_replace(".gif", "_na.gif", $tool['img']) . '" title="' . $tool_name . '" alt="' . $tool_name . '" align="absmiddle" border="0">';
                 // don't replace img with display::return_icon because $tool['img'] = api_get_path(WEB_IMG_PATH).$tool['img']
                 $cell_content .= '<span class="invisible">' . $tool_name . '</span>';
             }
         }
         $lnk = array();
         if (api_is_allowed_to_edit(null, true) && $cat != "courseAdmin" && !strpos($tool['link'], 'learnpath_handler.php?learnpath_id') && !api_is_coach()) {
             if ($tool['visibility']) {
                 $link['name'] = Display::return_icon('remove.gif', get_lang('Deactivate'), array('style' => 'vertical-align: middle;'));
                 $link['cmd'] = "hide=yes";
                 $lnk[] = $link;
             } else {
                 $link['name'] = Display::return_icon('add.gif', get_lang('Activate'), array('style' => 'vertical-align: middle;'));
                 $link['cmd'] = "restore=yes";
                 $lnk[] = $link;
             }
             if (is_array($lnk)) {
                 foreach ($lnk as &$this_lnk) {
                     if ($tool['adminlink']) {
                         $cell_content .= '<a href="' . $properties['adminlink'] . '">' . Display::return_icon('edit.gif', get_lang('Edit')) . '</a>';
                     } else {
                         $cell_content .= '<a href="' . api_get_self() . '?id=' . $tool['id'] . '&amp;' . $this_lnk['cmd'] . '">' . $this_lnk['name'] . '</a>';
                     }
                 }
             }
         }
         $table->setCellContents($cell_number / $numcols, $cell_number % $numcols, $cell_content);
         $table->updateCellAttributes($cell_number / $numcols, $cell_number % $numcols, 'width="32%" height="42"');
         $cell_number++;
     }
     return $table->toHtml();
 }
コード例 #25
0
ファイル: attendance.lib.php プロジェクト: daffef/chamilo-lms
 /**
  * @param string $startDate in UTC time
  * @param string $endDate in UTC time
  *
  * @return string
  */
 public function exportAttendanceLogin($startDate, $endDate)
 {
     $data = $this->getAttendanceLogin($startDate, $endDate);
     if (!$data) {
         return null;
     }
     $users = $data['users'];
     $results = $data['results'];
     $table = new HTML_Table(array('class' => 'data_table'));
     $table->setHeaderContents(0, 0, get_lang('User'));
     $table->setHeaderContents(0, 1, get_lang('Date'));
     $row = 1;
     foreach ($users as $user) {
         $table->setCellContents($row, 0, $user['lastname'] . ' ' . $user['firstname'] . ' (' . $user['username'] . ')');
         $row++;
     }
     $table->setColAttributes(0, array('style' => 'width:28%'));
     $row = 1;
     foreach ($users as $user) {
         if (isset($results[$user['user_id']]) && !empty($results[$user['user_id']])) {
             $dates = implode(', ', array_keys($results[$user['user_id']]));
             $table->setCellContents($row, 1, $dates);
         }
         $row++;
     }
     //$tableToString = null;
     //$sessionInfo = api_get_session_info(api_get_session_id());
     //if (!empty($sessionInfo)) {
     /*$tableToString .= '<strong>'.get_lang('PeriodToDisplay').'</strong>: '.
     		sprintf(get_lang('FromDateXToDateY'), $startDate, $endDate);*/
     //}
     $tableToString = $table->toHtml();
     $params = array('filename' => get_lang('Attendance') . '_' . api_get_utc_datetime(), 'pdf_title' => get_lang('Attendance'), 'course_code' => api_get_course_id(), 'show_real_course_teachers' => true);
     $pdf = new PDF('A4', null, $params);
     $pdf->html_to_pdf_with_template($tableToString);
 }
コード例 #26
0
 /**
  * @param array $headers
  * @param array $rows
  * @param array $attributes
  * @return string
  */
 public static function table($headers, $rows, $attributes = array())
 {
     if (empty($attributes)) {
         $attributes['class'] = 'data_table';
     }
     $table = new HTML_Table($attributes);
     $row = 0;
     $column = 0;
     //Course headers
     if (!empty($headers)) {
         foreach ($headers as $item) {
             $table->setHeaderContents($row, $column, $item);
             $column++;
         }
         $row = 1;
         $column = 0;
     }
     if (!empty($rows)) {
         foreach ($rows as $content) {
             $table->setCellContents($row, $column, $content);
             $row++;
             //$column++;
         }
     }
     return $table->toHtml();
 }
コード例 #27
0
 /**
  * @param string $categorySource
  *
  * @return string
  */
 function listCategories($categorySource)
 {
     $categorySource = isset($categorySource) ? $categorySource : null;
     $categories = self::getCategories($categorySource);
     if (count($categories) > 0) {
         $table = new HTML_Table(array('class' => 'data_table'));
         $column = 0;
         $row = 0;
         $headers = array(get_lang('Category'), get_lang('CategoriesNumber'), get_lang('Courses'), get_lang('Actions'));
         foreach ($headers as $header) {
             $table->setHeaderContents($row, $column, $header);
             $column++;
         }
         $row++;
         $mainUrl = api_get_path(WEB_CODE_PATH) . 'admin/course_category.php?category=' . $categorySource;
         $editIcon = Display::return_icon('edit.png', get_lang('EditNode'), null, ICON_SIZE_SMALL);
         $deleteIcon = Display::return_icon('delete.png', get_lang('DeleteNode'), null, ICON_SIZE_SMALL);
         $moveIcon = Display::return_icon('up.png', get_lang('UpInSameLevel'), null, ICON_SIZE_SMALL);
         foreach ($categories as $category) {
             $editUrl = $mainUrl . '&id=' . $category['code'] . '&action=edit';
             $moveUrl = $mainUrl . '&id=' . $category['code'] . '&action=moveUp&tree_pos=' . $category['tree_pos'];
             $deleteUrl = $mainUrl . '&id=' . $category['code'] . '&action=delete';
             $actions = Display::url($editIcon, $editUrl) . Display::url($moveIcon, $moveUrl) . Display::url($deleteIcon, $deleteUrl);
             $url = api_get_path(WEB_CODE_PATH) . 'admin/course_category.php?category=' . $category['code'];
             $title = Display::url(Display::return_icon('folder_document.gif', get_lang('OpenNode'), null, ICON_SIZE_SMALL) . ' ' . $category['name'], $url);
             $content = array($title, $category['children_count'], $category['nbr_courses'], $actions);
             $column = 0;
             foreach ($content as $value) {
                 $table->setCellContents($row, $column, $value);
                 $column++;
             }
             $row++;
         }
         return $table->toHtml();
     } else {
         return Display::return_message(get_lang("NoCategories"), 'warning');
     }
 }
コード例 #28
0
            if ($user['access_url_id'] != $url_id) {
                $userLink .= ' ' . Display::return_icon('warning.png', get_lang('UserNotAddedInURL'), array(), ICON_SIZE_SMALL);
                $add = Display::return_icon('add.png', get_lang('AddUsersToURL'), array(), ICON_SIZE_SMALL);
                $addUserToUrlLink = '<a href="resume_session.php?action=add_user_to_url&id_session=' . $sessionId . '&user_id=' . $user['user_id'] . '">' . $add . '</a>';
            }
        }
        $editUrl = null;
        /*
                if (isset($sessionInfo['duration']) && !empty($sessionInfo['duration'])) {
                    $editUrl = api_get_path(WEB_CODE_PATH) . 'session/session_user_edit.php?session_id=' . $sessionId . '&user_id=' . $userId;
                    $editUrl = Display::url(
                        Display::return_icon('agenda.png', get_lang('SessionDurationEdit')),
                        $editUrl
                    );
                }*/
        $table->setCellContents($row, 0, $userLink);
        $link = $reportingLink . $courseUserLink . $removeLink . $addUserToUrlLink . $editUrl;
        switch ($user['relation_type']) {
            case 1:
                $status = get_lang('Drh');
                $link = Display::url(Display::return_icon('edit.png', get_lang('Edit')), api_get_path(WEB_CODE_PATH) . 'admin/dashboard_add_sessions_to_user.php?user='******'Student');
        }
        $table->setCellContents($row, 1, $status);
        $table->setCellContents($row, 2, $link);
        $row++;
    }
    $userListToShow .= $table->toHtml();
}
コード例 #29
0
 /**
  * Returns a category summary report
  *
  * @param int exercise id
  * @param array prefilled array with the category_id, score, and weight example: array(1 => array('score' => '10', 'total' => 20));
  * @param bool $categoryMinusOne shows category - 1 see BT#6540
  * @return string
  */
 public static function get_stats_table_by_attempt($exercise_id, $category_list = array(), $categoryMinusOne = false)
 {
     if (empty($category_list)) {
         return null;
     }
     $category_name_list = Testcategory::getListOfCategoriesNameForTest($exercise_id, false);
     $table = new HTML_Table(array('class' => 'data_table'));
     $table->setHeaderContents(0, 0, get_lang('Categories'));
     $table->setHeaderContents(0, 1, get_lang('AbsoluteScore'));
     $table->setHeaderContents(0, 2, get_lang('RelativeScore'));
     $row = 1;
     $none_category = array();
     if (isset($category_list['none'])) {
         $none_category = $category_list['none'];
         unset($category_list['none']);
     }
     $total = array();
     if (isset($category_list['total'])) {
         $total = $category_list['total'];
         unset($category_list['total']);
     }
     $em = Database::getManager();
     $repo = $em->getRepository('ChamiloCoreBundle:CQuizCategory');
     $redefineCategoryList = array();
     if (!empty($category_list) && count($category_list) > 1) {
         $globalCategoryScore = array();
         foreach ($category_list as $category_id => $category_item) {
             $cat = $em->find('ChamiloCoreBundle:CQuizCategory', $category_id);
             $path = $repo->getPath($cat);
             $categoryName = $category_name_list[$category_id];
             $index = 0;
             if ($categoryMinusOne) {
                 $index = 1;
             }
             if (isset($path[$index])) {
                 $category_id = $path[$index]->getIid();
                 $categoryName = $path[$index]->getTitle();
             }
             if (!isset($globalCategoryScore[$category_id])) {
                 $globalCategoryScore[$category_id] = array();
                 $globalCategoryScore[$category_id]['score'] = 0;
                 $globalCategoryScore[$category_id]['total'] = 0;
                 $globalCategoryScore[$category_id]['title'] = '';
             }
             $globalCategoryScore[$category_id]['score'] += $category_item['score'];
             $globalCategoryScore[$category_id]['total'] += $category_item['total'];
             $globalCategoryScore[$category_id]['title'] = $categoryName;
         }
         foreach ($globalCategoryScore as $category_item) {
             $table->setCellContents($row, 0, $category_item['title']);
             $table->setCellContents($row, 1, ExerciseLib::show_score($category_item['score'], $category_item['total'], false));
             $table->setCellContents($row, 2, ExerciseLib::show_score($category_item['score'], $category_item['total'], true, false, true));
             $class = 'class="row_odd"';
             if ($row % 2) {
                 $class = 'class="row_even"';
             }
             $table->setRowAttributes($row, $class, true);
             $row++;
         }
         if (!empty($none_category)) {
             $table->setCellContents($row, 0, get_lang('None'));
             $table->setCellContents($row, 1, ExerciseLib::show_score($none_category['score'], $none_category['total'], false));
             $table->setCellContents($row, 2, ExerciseLib::show_score($none_category['score'], $none_category['total'], true, false, true));
             $row++;
         }
         if (!empty($total)) {
             $table->setCellContents($row, 0, get_lang('Total'));
             $table->setCellContents($row, 1, ExerciseLib::show_score($total['score'], $total['total'], false));
             $table->setCellContents($row, 2, ExerciseLib::show_score($total['score'], $total['total'], true, false, true));
             $table->setRowAttributes($row, 'class="row_total"', true);
         }
         return $table->toHtml();
     }
     return null;
 }
コード例 #30
0
ファイル: user_list.php プロジェクト: annickvdp/Chamilo1.9.10
        $userName = api_get_person_name($user['firstname'], $user['lastname']);

        $webDate = !empty($user['web_agreement_date']) ? api_get_local_time($user['web_agreement_date']) : '-';
        $mailDate = !empty($user['mail_agreement_date']) ? api_get_local_time($user['mail_agreement_date']) : '-';
        $url = $pluginPath.'user_list.php?action=resend&user_id='.$user['user_id'].'&'.api_get_cidreq();
        $link = Display::url(
            Display::return_icon('inbox.png', $legal->get_lang('ReSendMailAgreementLink')),
            $url
        );

        $deleteLink = Display::url(
            Display::return_icon('delete.png', $legal->get_lang('Delete')),
            $pluginPath.'user_list.php?action=delete&user_id='.$user['user_id'].'&'.api_get_cidreq()
        );

        $table->setCellContents($row, 0, $userName);
        $table->setCellContents($row, 1, $webDate);
        $table->setCellContents($row, 2, $mailDate);
        $table->setCellContents($row, 3, $link.' '.$deleteLink);

        $row++;
/*
        'web_agreement' => string '1' (length=1)
  'web_agreement_date' => string '2014-09-30 14:36:30' (length=19)
  'mail_agreement' => string '1' (length=1)
  'mail_agreement_date' => string '2014-09-30 14:43:16' (length=19)
  'mail_agreement_link' => s*/

    }
}
$url = $pluginPath.'start.php?'.api_get_cidreq();