Esempio n. 1
0
 function onCheckSchema()
 {
     $schema = Schema::get();
     $schema->ensureTable('task', Task::schemaDef());
     $schema->ensureTable('task_grader', Task_Grader::schemaDef());
     return true;
 }
Esempio n. 2
0
/**
 * 
 * BoloTweet 2.0
 *
 * @author   Alvaro Ortego <*****@*****.**>
 *
 */
define('STATUSNET', true);
define('LACONICA', true);
// compatibility
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../../..'));
require_once INSTALLDIR . '/lib/common.php';
require_once INSTALLDIR . '/local/plugins/Task/classes/Task_Grader.php';
$graderid = $_POST['graderid'];
$groupid = $_POST['groupid'];
$historical = Task_Grader::getHistorical($graderid, $groupid);
foreach ($historical as $taskHistory) {
    echo '<div id="task-' . $taskHistory['id'] . '" class="div-historical-task">';
    if ($taskHistory['status'] == 1) {
        $status = 'Iniciada';
    } else {
        $status = 'Cancelada';
    }
    if ($taskHistory['tag'] == "") {
        $taskHistory['tag'] = '&lt;Ninguno&gt;';
    }
    echo '<p><span class="historical-bold">' . $status . '</span> ' . '| <span class="historical-bold">Fecha:</span> ' . $taskHistory['cdate'] . ' ' . '| <span class="historical-bold">Tag:</span>  ' . $taskHistory['tag'] . ' ' . '| <span class="historical-bold">Completada:</span>  ' . $taskHistory['completed'] . '/' . $taskHistory['total'] . '</p>';
    if ($taskHistory['completed'] == 0) {
        if ($taskHistory['status'] == 1) {
            echo '<form action="' . common_local_url('taskcreate') . '" method="POST" class="ajax">';
            echo '<input type="hidden" value="' . $taskHistory[id] . '" name="cancel-task"></input>';
Esempio n. 3
0
 static function getHistorical($graderid, $groupid)
 {
     $task = new Task_Grader();
     $qry = 'select ' . '(select count(id) from task where id = tg.id and status = 1) as completed, ' . '(select count(id) as total from task where id = tg.id) as total, ' . 'tg.cdate as cdate, ' . 'tg.status as status, ' . 'tg.id as id, ' . 'tg.tag as tag ' . 'from task_grader tg ' . 'where tg.graderid = ' . $graderid . ' and tg.groupid = ' . $groupid . ' order by tg.cdate desc';
     $task->query($qry);
     $historical = array();
     while ($task->fetch()) {
         $historical[] = array('completed' => $task->completed, 'total' => $task->total, 'cdate' => $task->cdate, 'status' => $task->status, 'id' => $task->id, 'tag' => $task->tag);
     }
     return $historical;
 }
Esempio n. 4
0
 function initTask($groupid, $tag, $status, $taskid)
 {
     $result = array();
     if ($status == -1) {
         // Registramos la tarea en la tabla task_grader
         $id = Task_Grader::register(array('graderid' => $this->user->id, 'groupid' => $groupid, 'tag' => $tag));
         $idsUsers = Grades::getMembersExcludeGradersAndAdmin($groupid);
         // Creamos una tarea asociada para cada alumno del grupo.
         if (count($idsUsers) > 0) {
             Task::register(array('id' => $id, 'idsUsers' => $idsUsers));
         }
         $result[0] = 1;
         $result[1] = $id;
     } else {
         Task_Grader::updateTask($taskid, $tag);
         Task::reopenTask($taskid);
         $result[0] = 1;
         $result[1] = $taskid;
     }
     if ($this->boolean('ajax')) {
         $this->startHTML('text/xml;charset=utf-8');
         $this->elementStart('head');
         // TRANS: Title.
         $this->element('title', null, _m('Add to favorites'));
         $this->elementEnd('head');
         $this->elementStart('body');
         $form = new InitForm($this, $groupid, $result);
         $form->show();
         $this->elementEnd('body');
         $this->elementEnd('html');
     }
 }