Пример #1
0
 function __construct()
 {
     parent::__construct();
     $this->load->model('Users_model', '', TRUE);
     $this->Users_model->loginCheck();
     $this->load->model('Projects_model', '', TRUE);
     $this->load->model('Classes_model', '', TRUE);
     $this->load->model('Welcome_model', '', TRUE);
     $this->load->model('Results_model', '', TRUE);
     $this->load->model('Submit_model', '', TRUE);
     $this->load->model('Grade_model', '', TRUE);
     $this->load->model('Skills_model', '', TRUE);
     $this->load->helper('text');
     $this->load->helper('school');
     $this->load->helper('graph');
     if (!empty($this->input->get('school_year'))) {
         $this->school_year = $this->input->get('school_year');
     } else {
         $this->school_year = get_school_year();
     }
     $this->projects = $this->Projects_model->getAllActiveProjectsByClassAndSchoolYear($this->session->class, $this->school_year);
     $this->data['projects'] = $this->projects;
     $this->data['school_year'] = $this->school_year;
     $this->data['school_years'] = $this->Projects_model->getSchoolYears();
 }
Пример #2
0
 public function index()
 {
     // creates new PDF object
     $pdf = new Pdf();
     $this->Pdf_assessment_model->setDefaultConfig($pdf);
     $pdf->SetAuthor($this->session->name . ' ' . $this->session->last_name);
     $pdf->SetTitle(_('Fiche d\'évaluation'));
     // adds a page for each student
     $data = $this->prepareAssessmentRecords($this->input->post('project_id'), $this->input->post('term'));
     foreach ($data as $student) {
         $pdf->AddPage();
         $html = $this->Pdf_assessment_model->processAssessmentsRecordHtml($student);
         $pdf->writeHTML($html, false, false, false, false, '');
     }
     //Closes and opens a PDF file in new tab (arg 'I' in Output method)
     $this->load->helper('school');
     $filename = sanitize_name(get_school_year() . '_' . $data[0]['term'] . '_' . $data[0]['class'] . '_' . $data[0]['project_name']);
     $pdf->Output($filename . '.pdf', 'I');
 }
Пример #3
0
	/**
	 * Creates do_upload CI config for PDF instructions file
	 *
	 * @param 	string		$class
	 * @param 	string		$term
	 * @param 	string		$project_name
	 * @return	array
	 */
	public function getUploadPDFConfig($class, $term, $project_name)
	{
		$this->load->helper('school');
		$this->load->helper('format');

		$file_name = $class . '_' . $term . '_' . $project_name;
		$file_path = 'uploads/' . get_school_year() . '/' . strtoupper($class) . '/instructions/';

		// create dir if not exists
		if (!is_dir('assets/' . $file_path)) mkdir('assets/' . $file_path, 0755, TRUE);

		$config['file_name']            = sanitize_name($file_name);
		$config['overwrite']            = TRUE;
		$config['file_ext_tolower']     = TRUE;
		$config['upload_path']          = './assets/' . $file_path;
		$config['file_db_path']         = $file_path;
		$config['allowed_types']        = 'pdf';

		return($config);
	}
Пример #4
0
 function __construct()
 {
     $this->load->helper('school');
     $this->current_school_year = get_school_year();
 }
Пример #5
0
function get_assessment_pdf($data)
{
    // Include the main TCPDF library (search for installation path).
    require_once('tcpdf_include.php');

    // create new PDF document
    $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);

    // set document information
    $pdf->SetCreator('MediaGrade');
    $pdf->SetAuthor('Hélin');
    $pdf->SetTitle('Fiche d\'évaluation');

    // remove header and footer
    $pdf->setPrintHeader(false);
    $pdf->setPrintFooter(false);

    $pdf->SetFont('dejavusans', '', 9);
    $pdf->SetDefaultMonospacedFont('dejavusans', '', 8);

    // set margins
    $pdf->SetMargins(15, 15, 15);
    $pdf->SetHeaderMargin(10);
    $pdf->SetFooterMargin(10);

    // set auto page breaks
    $pdf->SetAutoPageBreak(FALSE, PDF_MARGIN_BOTTOM);

    // set image scale factor
    $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);

    // set some language-dependent strings (optional)
    if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
	    require_once(dirname(__FILE__).'/lang/eng.php');
	    $pdf->setLanguageArray($l);
    }

    // ---------------------------------------------------------

    // add a page for each student

    foreach ($data as $student)
    {

        $pdf->AddPage();

        // Table with rowspans and THEAD
        $tbl = '
        <h1>' . $_SESSION['last_name'] . '/ Laboratoire d\'audiovisuel / '. $student['project_name'] . '</h1>
        <table width="50%" style="padding:2px;">
	        <tbody >
	        <tr>
		        <td>Nom: '. $student['last_name'] . '</td>
		        <td>Prénom: '. $student['name'] . '</td>
	        </tr>

	        <tr>
	            <td>Classe: <b>'. $student['class'] . '</b></td>
	            <td>Année scolaire: ' . get_school_year() . '</td>

	        </tr>

	        <tr>
		        <td>Date de remise:</td>
		        <td>'. ($student['time'] ? $student['time'] . ' ' : '') . '(Période ' . $student['term'] . ')</td>
	        </tr>
	        </tbody>
        </table>
        ';

        if(file_exists($student['thumbnail']) && substr($student['thumbnail'], -3) === 'jpg')
            $tbl .= '<br /><br /><img src="'. $student['thumbnail'] . '" height="200px" />';

        $tbl .= '<br />
        <h3>Fiche d\'évaluation</h3>';

        $tbl .= '<p>Compétences travaillées: '. $student['skill_id'] .'.</p>
        <style type="text/css">
        .tg  {padding:3px;border-collapse:collapse;border-spacing:0;}
        .tg td{border-style:solid;border-width:1px;}
        .tg th{font-weight: bold;border-style:solid;border-width:1px;}
        .tg .tg-fqys{background-color:#333333;color:#ffffff;vertical-align:top}
        .tg .tg-yw4l{vertical-align:top
        }
        </style>
        <table class="tg">
          <tr>
            <th width="15%" class="tg-fqys">Objectif</th>
            <th width="20%" class="tg-fqys">Critères</th>
            <th width="45%" class="tg-fqys">Indicateurs (l\'élève a:)</th>
            <th width="20%" class="tg-fqys">Résultat</th>
          </tr>';

      $control = $student['results'][0]['objective'];
      $last_grand_total = '';
      $i = 0;

      foreach($student['results'] as $result)
      {

         if($control !== $result['objective'])
         {

            $control = $result['objective'];
            $tbl .= '<tr>
                <td class="tg-yw4l"></td>
                <td class="tg-yw4l"></td>
                <td class="tg-yw4l" style="text-align:right;"><b>Total ' . $control .' : </b></td>
                <td class="tg-yw4l">'. $student['grand_total'][$i]['user_total'] . '/' . $student['grand_total'][$i]['grand_total'] . '</td>
                </tr>';
                $i++;
         }

         $tbl .= '<tr>
        <td class="tg-yw4l">'. $result['objective'] . '</td>
        <td class="tg-yw4l">'. $result['criteria'] . '</td>
        <td class="tg-yw4l">'. $result['cursor'] . '<br /></td>
        <td class="tg-yw4l">'. $result['result'] . ' (' . $result['acquis'] . ')</td>
        </tr>';

        $last_grand_total = $student['grand_total'][$i]['grand_total'] ;
        $last_user_total = $student['grand_total'][$i]['user_total'] ;
      }

      // add last grand total
      $tbl .= '<tr>
                <td class="tg-yw4l"></td>
                <td class="tg-yw4l"></td>
                <td class="tg-yw4l" style="text-align:right;"><b>Total ' . $control .' : </b></td>
                <td class="tg-yw4l">'. $last_user_total . '/' . $last_grand_total .'</td>
                </tr>';

      $tbl .= '</table>';

      if($student['self_assessment'])
      {
          $tbl .= '<h3>Auto-évaluation</h3>';

          foreach ($student['self_assessment'] as $row)
          {
              $tbl .= '
                <b>' . $row['question'] . '</b>
                <p><pre>"' . $row['answer'] . '"</pre></p>';
          }
      }
      if($student['comment'])
      {
           $tbl .=  '<h3>Commentaires du professeur</h3>

                <p><pre>' . $student['comment'] . '</pre></p>';
      }
        $pdf->writeHTML($tbl, false, false, false, false, '');
    }

    // ---------------------------------------------------------

    //Close and output PDF document
    $filename = sanitize_name(get_school_year() . '_' .  $data[0]['term'] . '_' . $data[0]['class'] . '_' . $data[0]['project_name']);
    $pdf->Output($filename . '.pdf', 'I');

}
Пример #6
0
#
# $Id: classes.php 4 2010-02-02 18:52:58Z kuzmich $
#
define('ADMIN_ZONE', true);
include_once '../init.php';
include_once '../include/classes.php';
include_once '../include/curriculums.php';
$school_years = get_school_years() or die("Вы должны добавить хотя бы один учебный год.");
$school_year_id = intval(@$_REQUEST['school_year_id']);
$curr_year = null;
if ($school_year_id == 0) {
    //assign $school_year_id to current period or to the last one
    $cur_time = time();
    foreach ($school_years as $year) {
        if (strtotime($year['started']) < $cur_time and $cur_time < strtotime($year['finished'])) {
            break;
        }
    }
    $school_year_id = $year['school_year_id'];
    $curr_year = $year;
}
$classes_list = get_classes_list($school_year_id);
if (!isset($curr_year)) {
    $curr_year = get_school_year($school_year_id);
}
$template_name = isAjax() ? 'classes-ajax.html' : 'classes.html';
$renderArray = array('school_year_id' => $school_year_id, 'school_years' => $school_years, 'classes_list' => $classes_list);
$renderArray['current_year'] = $curr_year;
$renderArray['ui_theme'] = $config['ui']['theme'];
$template = $twig->loadTemplate('admins/' . $template_name);
echo $template->render($renderArray);
Пример #7
0
 /**
  *
  *		PROJECTS MANAGEMENT PAGE
  *
  */
 public function project_management($project_id = FALSE)
 {
     // Models
     $this->load->model('Assessment_model', '', TRUE);
     $this->load->model('ProjectsManager_model', '', TRUE);
     $this->load->model('Terms_model', '', TRUE);
     $this->load->model('Comments_model', '', TRUE);
     $this->load->model('FilesFormat_model', '', TRUE);
     // TODO : control for empty fields
     // POST
     if ($this->input->post('disactivate_project')) {
         $this->ProjectsManager_model->switchProjectState($this->input->post('disactivate_project'));
     } elseif ($this->input->post('delete_project')) {
         $this->ProjectsManager_model->deleteProject($this->input->post('delete_project'));
         redirect('/admin/projects');
     } elseif ($this->input->post()) {
         $post = $this->input->post();
         // Create new project or Update project
         if ($post['project_id'] == '-1') {
             $this->ProjectsManager_model->addProject($post);
         } else {
             $this->ProjectsManager_model->updateProject($post, $project_id);
         }
         // Save & upload (or not) PDF instructions
         if (@$_FILES['instructions_pdf']['size'] > 0) {
             $post['instructions_pdf'] = $this->uploadPDF($post);
         } else {
             $post['instructions_pdf'] = FALSE;
         }
         redirect('/admin/projects?school_year=' . get_school_year());
     }
     // GET data from argument (to get project info)
     if ($project_id) {
         $this->data['curr_project'] = $this->Projects_model->getProjectDataByProjectId($project_id);
         $this->data['active_skills'] = $this->Skills_model->getAllSkillsByProjects($project_id, TRUE);
         $this->data['assessment_table'] = $this->Assessment_model->getAssessmentTable($project_id, TRUE);
         $this->data['active_self_assessments'] = $this->Assessment_model->getSelfAssessmentIdsByProject($project_id);
     } else {
         // user wants to create a new empty project
         $this->data['assessment_table'] = array(new Assessment_model());
     }
     // Get data
     $this->data['file_formats'] = $this->FilesFormat_model->getAllDistinctFormats();
     $this->data['projects'] = $this->Projects_model->getAllActiveProjectsByAdmin(FALSE);
     $this->data['skills'] = $this->Skills_model->getAllSkills();
     $this->data['self_assessments'] = $this->Assessment_model->getAllSelfAssessments();
     $this->data['skills_groups'] = $this->Skills_model->getAllSkillsGroups();
     $this->load->helper('text');
     $this->load->helper('deadline');
     $this->load->template('admin/project_management', $this->data, TRUE);
 }
Пример #8
0
    <ul class="nav sidebar-nav " data-spy="affix" data-offset-top="90">
        <li <?= ( $this->uri->segment(2) === 'dashboard'  ? 'class="active"' : '') ?>><a href="/admin/dashboard?school_year=<?= get_school_year() ?>"><span class="glyphicon glyphicon-dashboard"></span> <?= _('DASHBOARD') ?><span class="sr-only">(current)</span></a></li>
        <li class="divider" role="separator"></li>
        <li <?= ( $this->uri->segment(2) === 'projects'  ? 'class="active"' : '') ?>><a href="/admin/projects?school_year=<?= get_school_year() ?>"><span class="glyphicon glyphicon-file"></span> <?= _('PROJETS') ?></a></li>
        <li <?= ( $this->uri->segment(2) === 'grade'  ? 'class="active"' : '') ?>><a href="/admin/grade?school_year=<?= get_school_year() ?>"><span  class="glyphicon glyphicon glyphicon-import"></span> <?= _('CORRIGER') ?></a></li>
        <li <?= ( $this->uri->segment(2) === 'results'  ? 'class="active"' : '') ?>>
            <a href="#" class="dropdown-toggle" data-toggle="dropdown"><span  class="glyphicon glyphicon-education"></span> <?= _('RÉSULTATS') ?> <span class="caret"></span></a>
            <ul class="nav dropdown-menu custom-menu">
                <?php foreach($classes as $class): ?>
                <li>
                    <a href="/admin/results/<?= $class ?>?school_year=<?= get_school_year() ?>"><?= $class ?></a>
                </li>
                <?php endforeach ?>
            </ul>
        </li>
        <li<?= ( $this->uri->segment(2) === 'export'  ? ' class="active"' : '') ?>><a href="/admin/export?school_year=<?= get_school_year() ?>"><span  class="glyphicon glyphicon-book"></span> <?= _('FICHES D\'ÉVALUATION') ?></a></li>
        <li<?= ( $this->uri->segment(1) === 'gallery'  ? ' class="active"' : '') ?>><a href="/gallery"><span class="glyphicon glyphicon-sunglasses"></span> <?= _('GALLERIE') ?></a></li>
        <li class="divider" role="separator"></li>
        <li <?= ( $this->uri->segment(2) === 'skills' || $this->uri->segment(2) === 'skills_groups' || $this->uri->segment(2) === 'users' || $this->uri->segment(2) === 'terms'? 'class="active"' : '') ?>>
            <a href="#" class="dropdown-toggle" data-toggle="dropdown"><span  class="glyphicon glyphicon-warning-sign"></span> <?= _('CONFIG') ?> <span class="caret"></span></a>
            <ul class="nav dropdown-menu custom-menu">
                  <li><a href="/admin/skills"><?= _('COMPÉTENCES') ?></a></li>
                  <li><a href="/admin/skills_groups"><?= _('GROUPES DE CPT') ?></a></li>
                  <li><a href="/admin/users"><?= _('ÉLÈVES') ?></a></li>
                  <li><a href="/admin/terms"><?= _('PÉRIODES') ?></a></li>
                  <li><a href="/admin/welcome_message"><?= _('ACCUEIL') ?></a></li>
            </ul>
        </li>
        <li<?= ( $this->uri->segment(2) === 'settings'  ? ' class="active"' : '') ?>><a href="/admin/settings"><span  class="glyphicon glyphicon-wrench"></span> <?= _('SYSTÉME') ?></a></li>
      </ul>
</aside>
Пример #9
0
	/**
	 * Returns if a project is in current school year
	 *
	 * @param 	integer		$project_id
	 * @return	boolean
	 */
	public function boolMatchProjectSchoolYear($project_id)
	{
		$this->load->helper('school');
		$project_sy = $this->getProjectDataByProjectId($project_id)->school_year;

		return (get_school_year() === $project_sy);
	}
Пример #10
0
            if(!$cols.length) $cols = $row.find('th');
            return $cols.map(grabCol)
            .get().join(tmpColDelim);
        }
        // Grab and format a column from the table
        function grabCol(j,col){
            var $col = $(col),
            $text = $col.text();
            return $text.replace('"', '""'); // escape double quotes
        }
    }
    // This must be a hyperlink
    $("#export").click(function (event) {
        // var outputFile = 'export'
        <?php $this->load->helper('school'); ?>
        var outputFile = '<?=  get_school_year() . '_' . $this->uri->segment(4, 0)  . '_' . $class  ?>' + '.csv'

        // CSV
        exportTableToCSV.apply(this, [$('#dvData>table'), outputFile]);

        // IF CSV, don't do event.preventDefault() or return false
        // We actually need this to be a typical hyperlink
    });
});
</script>

<!-- Updates modal-->
<script>
    $(document).on('hidden.bs.modal', function (e) {
        $(e.target).removeData('bs.modal');
    });
Пример #11
0
	/**
	 * Generate a filepath from a project id
	 * Format: upload/SCHOOL_YEAR/class/term
	 *
	 * @param 	integer 	$project_id
	 * @return	string
	 */
    private function _generateProjectFilePath($project_id)
    {
        $this->load->helper('school');
        $this->load->helper('format');

        // get data
        $project_data = $this->getSubmitInformations($project_id);
        $sanitized_project_name = sanitize_name($project_data->project_name);

        // puts the file in ./upload/2015-2016/class/term
        $upload_dir = 'uploads/' . get_school_year() . '/' . $project_data->class . '/' . strtolower($project_data->term) . '/' . $sanitized_project_name . '/';

        // create dir if doesn't exist
        if ( ! is_dir('assets/' . $upload_dir)) mkdir('assets/' . $upload_dir, 0755, TRUE);

        return $upload_dir;
    }
Пример #12
0
<div id="content" class="col-xs-12 col-md-10 ">
    <div class="row chapeau">
        <div class="col-xs-9  col-md-9">
            <h1> <?= _('Tableau de bord') ?></h1>
        </div>
        <div class="col-xs-3  col-md-3">
              <form id="filter" action="" method="get" class="form-inline" style="margin-top:1.5em">
                <label><?= _('Année scolaire') ?>: </label>
                <div class="input-group">
                    <select class="form-control input-sm" name="school_year" onchange="this.form.submit()">
                        <?php foreach($school_years as $row): ?>
                            <?= '<option value="' . $row->school_year . '"' . ( @$_GET['school_year'] === $row->school_year || ( !isset($_GET['school_year']) && $row->school_year === get_school_year() ) ? ' selected' : '') . '>' . $row->school_year . '</option>' . "\n" ?>
                        <?php endforeach?>
                    </select>
                </div>
            </form>
        </div>
    </div>

    <?= $content ?>

    <!-- PANELS -->
    <div class="row" style="margin-top:1em">
        <div class="col-lg-5 col-md-6 col-xs-12 ">
            <div class="panel panel-danger">
                <div class="panel-heading text-center" style="background-color:#d9534f;color:white"><?= _('À remettre')?> <span class="badge"><?= count($not_submitted) ?></span></div>
                <div class="panel-body text-left">
                    <table class="table table-striped small">
                        <?php foreach($not_submitted as $row): ?>
                            <tr>
                                <td><?= $row->term ?></td>
Пример #13
0
	</div>
	<hr />
	<div class = "row">
		<div class = "col-md-12">
			<div class="form-group">
			<?php if($curr_project->school_year === get_school_year()): ?>
				<button type="submit" class="btn btn-primary"><?=  LABEL_SAVE_PROJECT ?></button>
				<input type="hidden" name="project_id" value="<?= (isset($curr_project->id) ? $curr_project->id : '-1'); ?>">
				<?php if(isset($curr_project->id)): ?>
				<button type="submit" class="btn btn-danger pull-right" name="delete_project" value="<?= $curr_project->id ?>"><span class="glyphicon glyphicon-remove"></span><?=  LABEL_DEL_PROJECT ?></button>
				<button type="submit" class="btn <?= (@$curr_project->is_activated ? 'btn-warning' : 'btn-success'); ?>  pull-right"  style="margin-right:0.5em;" name="disactivate_project" value="<?= $curr_project->id ?>">
				<span class="glyphicon glyphicon-ban-circle"></span> <?= (@$curr_project->is_activated ?  LABEL_DISACTIVATE_PROJECT :  LABEL_ACTIVATE_PROJECT)?>
				</button>
				<?php endif ?>
			<?php else: ?>
				<p><?= _('Projet verrouillé (année scolaire ' . get_school_year() . ').')?></p>
			<?php endif ?>
			</div>
		</div>
	</div>
</form>

<script src="/assets/js/jquery-1.10.2.min.js"></script>
<script src="/assets/js/typeahead.bundle.js"></script>
<script>
	/**
	 *
	 *  Typeahead
	 *
	 **/