public function listAll($curso = "") { global $uid, $uperms; $and = ""; if (!$uperms['cursos_w']) { $and .= "AND c.tutor_id = '{$uid}' "; } if ($curso != "") { $and .= "AND ct.nombre LIKE '%{$curso}%' "; } $db = new DB(); $sql = "SELECT c.id, c.grupo, c.dia, c.hora, c.estado, ct.nombre, c.tutor_id, " . "CONCAT(p.anio,'-',p.semestre) AS periodo, " . "pr.programa, CONCAT(u.nombres, ' ', u.apellidos) AS tutor FROM cursos c " . "INNER JOIN catedra ct ON c.catedra_id = ct.id " . "INNER JOIN periodos p ON c.periodo_id = p.id " . "INNER JOIN programas pr ON ct.programas_id = pr.id " . "INNER JOIN usuarios u ON c.tutor_id = u.id " . "WHERE c.id > 0 {$and}"; if (isset($_GET['starting'])) { $starting = $_GET['starting']; } else { $starting = 0; } $objpag = new Pagination($sql, $starting, 20, 'index2.php?com=cursos&do=search'); $res = $objpag->result; $data = array(); $x = 0; while ($line = $objpag->fetchNextObject($res)) { $data[$x]['id'] = $line->id; $data[$x]['programa'] = $line->programa; $data[$x]['grupo'] = $line->grupo; $data[$x]['curso'] = $line->nombre; $data[$x]['periodo'] = $line->periodo; $data[$x]['tutor'] = $line->tutor; $data[$x]['tutor_id'] = $line->tutor_id; $data[$x]['dia'] = CatManUtils::getDiaNombre($line->dia); $data[$x]['hora'] = $line->hora; $data[$x]['agenda'] = $this->siTieneAgenda($line->id); $data[$x]['estado'] = Elfic::getBlockIcon($line->estado); $x++; } $anchors = $objpag->anchors; $total = $objpag->total; $tpl = new Elfic_Smarty(); $tpl->assign('data', $data); $tpl->assign('anchors', $anchors); $tpl->assign('total', $total); $tpl->display('cursos/cursosList.tpl'); }