コード例 #1
0
 /**
  * Handle request
  *
  * This is the main method for handling a request. Note that
  * most preparation should be done in the prepare() method;
  * by the time handle() is called the action should be
  * more or less ready to go.
  *
  * @param array $args $_REQUEST args; handled in prepare()
  *
  * @return void
  */
 function handle($args)
 {
     parent::handle($args);
     if (!common_logged_in()) {
         $this->clientError(_('Not logged in.'));
         return;
     }
     if (!$this->user->hasRole('grader')) {
         $this->clientError(_('Usted no tiene privilegios para visitar esta página.'));
         return;
     }
     $groupid = $this->trimmed('groupid');
     $delimiter = $this->trimmed('grade-export-delimiter');
     $separator = $this->trimmed('grade-export-separator');
     $arrayReport = Grades::getGradedNoticesAndUsersWithinGroup($groupid);
     $nicksMembers = Grades::getMembersNicksExcludeGradersAndAdmin($groupid);
     foreach ($nicksMembers as $nick) {
         if (!array_key_exists($nick, $arrayReport)) {
             $arrayReport[$nick] = 0;
         }
     }
     $arrayFinal = array();
     foreach ($arrayReport as $alumno => $puntuacion) {
         $arrayFinal[] = array($alumno, number_format($puntuacion, 2));
     }
     $this->generarInformeCSV($arrayFinal, 'report_group_' . $groupid . '.csv', $separator, $delimiter);
 }
コード例 #2
0
ファイル: gradereport.php プロジェクト: Grasia/bolotweet
function reportGroupGrades($groupnick)
{
    $groupgrades = Grades::getGradedNoticesAndUsersWithinGroup($groupnick);
    print PHP_EOL;
    print PHP_EOL;
    print sprintf(_m('Group %s report' . PHP_EOL), $groupnick);
    foreach ($groupgrades as $login => $sumnoticegrades) {
        print sprintf(_m('+ %s : %s' . PHP_EOL), $login, $sumnoticegrades);
    }
}
コード例 #3
0
 function showReportGrader()
 {
     $groupsUser = $this->user->getGroups()->fetchAll();
     if (empty($groupsUser)) {
         $this->element('p', null, 'Todavía no perteneces a ningún grupo.');
     }
     foreach ($groupsUser as $group) {
         $gradespergroup = Grades::getGradedNoticesAndUsersWithinGroup($group->id);
         $nicksMembers = Grades::getMembersNicksExcludeGradersAndAdmin($group->id);
         foreach ($nicksMembers as $nick) {
             if (!array_key_exists($nick, $gradespergroup)) {
                 $gradespergroup[$nick] = '0';
             }
         }
         $this->elementStart('div', array('id' => 'grade-report-group-' . $group->id, 'class' => 'div-group-report'));
         $this->elementStart('h3', array('class' => 'grade-report-group', 'title' => $group->getBestName()));
         $this->element('a', array('class' => 'grade-report-group-link', 'href' => common_root_url() . 'group/' . $group->nickname), $group->getBestName());
         $this->elementEnd('h3');
         $this->element('a', array('class' => 'grade-show-report', 'href' => 'javascript:mostrarReport(' . $group->id . ');'), 'Expandir');
         $this->element('a', array('class' => 'grade-export-report', 'href' => common_local_url('gradeoptionscsv') . '?group=' . $group->id), 'Exportar CSV');
         $this->element('p', array('class' => 'grade-reports-group-underline'), '');
         $this->elementStart('div', array('class' => 'report-group-hidden'));
         if (empty($gradespergroup)) {
             $this->element('p', null, 'Todavía no hay puntuaciones.');
         } else {
             $this->elementStart('ol', array('class' => 'grade-report-groupmembers'));
             foreach ($gradespergroup as $alumno => $puntuacion) {
                 $this->elementStart('li', array('class' => 'grade-report-groupmembers-item'));
                 $profile = Profile::staticGet('nickname', $alumno);
                 $avatar = $profile->getAvatar(AVATAR_MINI_SIZE);
                 if ($avatar) {
                     $avatar = $avatar->displayUrl();
                 } else {
                     $avatar = Avatar::defaultImage(AVATAR_MINI_SIZE);
                 }
                 $this->element('img', array('src' => $avatar));
                 $this->elementStart('a', array('class' => 'user-link-report', 'href' => common_local_url('gradeshowuser', array('nickgroup' => $group->nickname, 'nickname' => $profile->nickname))));
                 $this->raw($profile->getBestName() . ', ' . number_format($puntuacion, 2));
                 $this->elementEnd('a');
                 $this->elementEnd('li');
             }
             $this->elementEnd('ol');
         }
         $this->elementEnd('div');
         $this->elementEnd('div');
     }
 }