Esempio n. 1
0
 public function save_info(StudentRequest $request)
 {
     $mark = new Mark();
     $mark->student_id = $request->student_id;
     $mark->disp_id = $request->disp_id;
     $mark->value_1 = $request->value_1;
     $mark->value_2 = $request->value_2;
     $mark->value_3 = $request->value_3;
     $mark->save();
     return back();
 }
Esempio n. 2
0
 /**
  * Retourne toutes les marks enregistrées.
  * 
  * @return array[Mark] Tous les objets dans un tableau.
  */
 public static function findAll()
 {
     $mesMarks = array();
     $data = BaseSingleton::select('SELECT id, bareme_id, maxi, mini, grade ' . 'FROM mark ');
     foreach ($data as $row) {
         $mark = new Mark();
         $mark->hydrate($row);
         $mesMarks[] = $mark;
     }
     return $mesMarks;
 }
Esempio n. 3
0
 public function mark()
 {
     $this->load->model('mark');
     $this->load->library('json');
     $mark = new Mark();
     $query = $mark->getJSONMark(32);
     $results = $query->result_array();
     foreach ($results as $row) {
         $jsonResponse = $row['markData'];
     }
     $this->load->view('marker/mark', array('mark' => $jsonResponse));
 }
Esempio n. 4
0
 public function actionMark()
 {
     if (Yii::app()->request->isAjaxRequest && !Yii::app()->user->isGuest) {
         if (!isset($_GET['id'])) {
             throw new CHttpException(404, 'Страница не найденa');
         } else {
             $site_id = $_GET['id'];
             $site = Site::model()->findByPk($site_id);
             if ($site == null) {
                 throw new CHttpException(404, 'Страница не найденa');
             } else {
                 $mark = Mark::model()->find('site_id = :site_id AND user_id = :user_id', array('site_id' => $site->site_id, 'user_id' => Yii::app()->user->id));
                 if ($mark != null) {
                     $mark->delete();
                 }
                 $mark = new Mark();
                 $mark->user_id = Yii::app()->user->id;
                 $mark->site_id = $site_id;
                 $mark->value = $_POST['value'];
                 $mark->save();
                 print 'Ваш голос учтен';
                 Yii::app()->end();
             }
         }
     } else {
         throw new CHttpException(404, 'Страница не найдена');
     }
 }
 function drawComponent($drawer, $x1, $y1, $x2, $y2, $aliasing)
 {
     $max = $this->getRealYMax();
     $min = $this->getRealYMin();
     // Get start and stop values
     list($start, $stop) = $this->getLimit();
     if ($this->lineMode === LINEPLOT_MIDDLE) {
         $inc = $this->xAxis->getDistance(0, 1) / 2;
     } else {
         $inc = 0;
     }
     // Build the polygon
     $polygon = new awPolygon();
     for ($key = $start; $key <= $stop; $key++) {
         $value = $this->datay[$key];
         if ($value !== NULL) {
             $p = awAxis::toPosition($this->xAxis, $this->yAxis, new awPoint($key, $value));
             $p = $p->move($inc, 0);
             $polygon->set($key, $p);
         }
     }
     // Draw backgrounds
     if (is_a($this->lineBackground, 'awColor') or is_a($this->lineBackground, 'awGradient')) {
         $backgroundPolygon = new awPolygon();
         $p = $this->xAxisPoint($start);
         $p = $p->move($inc, 0);
         $backgroundPolygon->append($p);
         // Add others points
         foreach ($polygon->all() as $point) {
             $backgroundPolygon->append($point);
         }
         $p = $this->xAxisPoint($stop);
         $p = $p->move($inc, 0);
         $backgroundPolygon->append($p);
         // Draw polygon background
         $drawer->filledPolygon($this->lineBackground, $backgroundPolygon);
     }
     $this->drawArea($drawer, $polygon);
     // Draw line
     $prev = NULL;
     // Line color
     if ($this->lineHide === FALSE) {
         if ($this->lineColor === NULL) {
             $this->lineColor = new awColor(0, 0, 0);
         }
         foreach ($polygon->all() as $point) {
             if ($prev !== NULL) {
                 $drawer->line($this->lineColor, new awLine($prev, $point, $this->lineStyle, $this->lineThickness));
             }
             $prev = $point;
         }
         $this->lineColor->free();
     }
     // Draw marks and labels
     foreach ($polygon->all() as $key => $point) {
         $this->mark->draw($drawer, $point);
         $this->label->draw($drawer, $point, $key);
     }
 }
 public function delete($id)
 {
     $mark = Mark::find($id);
     $mark->softDeletes();
     // redirect
     Session::flash('message', 'Successfully deleted the mark!');
     return Redirect::to('admin/mark');
 }
 public function getMarks($contactId)
 {
     try {
         $marks = Mark::where('people_id', $contactId)->where('published', 1)->paginate(20);
         $this->googleAnalytics('/contacts/marks/' . $contactId);
         return Response::json($marks);
     } catch (Exception $e) {
         return Response::json(array('status' => 'fail'));
     }
 }
 public static function fromArray(&$p)
 {
     $marks = array();
     if (isset($p['marks'])) {
         foreach ($p['marks'] as $mark) {
             $marks[] = Mark::fromArray($mark);
         }
     }
     return new Pier($p['id'], $p['observatory_id'], $p['name'], $p['begin'], $p['end'], $p['correction'], $p['defaul_mark_id'], $p['default_electronics_id'], $p['default_theodolite_id'], $marks);
 }
Esempio n. 9
0
 function testBuildFromJSON()
 {
     $this->CI->load->library('json');
     $this->CI->load->model('mark');
     $mark = new Mark();
     $mark->buildFromJSON($this->_jsonTest);
     $this->assertEqual('FirstTest', $mark->get('classification'), 'Classification extracted from JSON');
     $data = $mark->get('markData');
     $this->assertEqual('Test general com', $data->generalComment, 'Ensure json process transparent');
     try {
         $mark = new Mark();
         $mark->buildFromJSON('{}xxx');
     } catch (Exception $e) {
         $this->pass("Detected invalid JSON");
         $passed = true;
     }
     if (!$passed) {
         $this->fail("Failed to detect invalid JSON");
     }
 }
Esempio n. 10
0
 private function _sendPayment($marker, $marks, $assessmentAssoc, $assessmentFix = 0)
 {
     if (count($marks) === 0 && empty($assessmentAssoc)) {
         return false;
     }
     foreach ($marks as $markAssoc) {
         $mark = new Mark();
         $mark->setKey($markAssoc[$mark->getKeyField()]);
         $mark->paid();
         $mark->update();
         $markKeys[] = $markAssoc[$mark->getKeyField()];
     }
     $assessmentAmount = 0;
     if (!empty($assessmentAssoc)) {
         $assessment = new Assessment();
         $assessment->setKey($assessmentAssoc[$assessment->getKeyField()]);
         $assessment->paid();
         $assessment->update();
         $markKeys[] = 'Assessment script';
         $assessmentAmount = 1;
     }
     if ($assessmentFix) {
         $assessmentFix = new AssessmentFix();
         $assessmentFix->setKey($this->_getUser());
         $assessmentFix->paid();
         $assessmentFix->update();
         $markKeys[] = 'Assessment bounty';
     }
     $this->load->model('wage');
     $amount = ($assessmentFix + count($marks) + $assessmentAmount) * 1.5;
     $wage = new Wage();
     $wage->paid($marker, $amount, $markKeys);
     $wage->create();
     return $amount;
 }
 public function drawComponent(awDrawer $drawer, $x1, $y1, $x2, $y2, $aliasing)
 {
     $count = count($this->datay);
     // Get start and stop values
     list($start, $stop) = $this->getLimit();
     // Build the polygon
     $polygon = new awPolygon();
     for ($key = 0; $key < $count; $key++) {
         $x = $this->datax[$key];
         $y = $this->datay[$key];
         if ($y !== NULL) {
             $p = awAxis::toPosition($this->xAxis, $this->yAxis, new awPoint($x, $y));
             $polygon->set($key, $p);
         } else {
             if ($this->linkNull === FALSE) {
                 $polygon->set($key, NULL);
             }
         }
     }
     // Link points if needed
     if ($this->link) {
         $prev = NULL;
         foreach ($polygon->all() as $point) {
             if ($prev !== NULL and $point !== NULL) {
                 $drawer->line($this->lineColor, new awLine($prev, $point, $this->lineStyle, $this->lineThickness));
             }
             $prev = $point;
         }
         $this->lineColor->free();
     }
     // Draw impulses
     if ($this->impulse instanceof awColor) {
         foreach ($polygon->all() as $key => $point) {
             if ($point !== NULL) {
                 $zero = awAxis::toPosition($this->xAxis, $this->yAxis, new awPoint($key, 0));
                 $drawer->line($this->impulse, new awLine($zero, $point, awLine::SOLID, 1));
             }
         }
     }
     // Draw marks and labels
     foreach ($polygon->all() as $key => $point) {
         $this->mark->draw($drawer, $point);
         $this->label->draw($drawer, $point, $key);
     }
 }
Esempio n. 12
0
 public function getDestroy($id)
 {
     if (Session::get('user_level') < Config::get('cms.deleteContacts')) {
         return Redirect::to(_l(URL::action('AdminHomeController@getIndex')))->with('message', Lang::get('admin.notPermitted'))->with('notif', 'warning');
     }
     try {
         $mark = Mark::onlyTrashed()->findOrFail($id);
         $mark->forceDelete();
         return Redirect::to(_l(URL::action('MarkController@getTrashed')))->with('message', Lang::get('admin.markDeleted'))->with('notif', 'success');
     } catch (Exception $e) {
         return Redirect::to(_l(URL::action('MarkController@getTrashed')))->with('message', Lang::get('admin.noSuchMark'))->with('notif', 'danger');
     }
 }
Esempio n. 13
0
<?php

$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('action' => Yii::app()->createUrl($this->route), 'method' => 'get'));
?>

	<?php 
echo $form->textFieldRow($model, 'id', array('class' => 'span5', 'maxlength' => 10));
?>

	<?php 
echo $form->textFieldRow($model, 'name', array('class' => 'span5', 'maxlength' => 256));
?>

	<?php 
echo $form->dropDownListRow($model, 'mark_id', CHtml::listData(Mark::model()->findAll(), 'id', 'name'), array('name' => 'Models[mark_id]'));
?>

	<?php 
echo $form->checkBoxRow($model, 'pop');
?>

	<div class="form-actions">
		<?php 
$this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'submit', 'type' => 'primary', 'label' => 'Искать'));
?>
	</div>

<?php 
$this->endWidget();
?>
Esempio n. 14
0
<?php

/**
 * Created by PhpStorm.
 * User: Amali
 * Date: 10/8/14
 * Time: 10:39 AM
 */
require_once "mark_view.php";
if (empty($_POST["Course"])) {
    echo '<p style="color:#e40005;  margin-left: 20px; text-align:center; font-family: Century Gothic; font-size:22px;background-color: #ffebe8;padding: 25px;margin: 25px; border-style: solid; border-color:#dd3c10 ">Enter Course Name</p>';
} else {
    $cors = $_POST["Course"];
    session_start();
    $username = $_SESSION['user_name'];
    $mark = new Mark();
    $mark->test($cors);
    //$mark->getmark("SELECT * FROM marks WHERE Student_ID = '{$username}' AND Course_Course_ID = '{$cors}'}' ",$cors,$username);
}
Esempio n. 15
0
    <p>Course</p>
</div>
<div class="panel" id="panel">
    <div class="panel_body">
        <div class="panel_bar" >
        </div>
        <div class="panel_body_cont">

            <form action="/ACTA_project/mod/student/course.php" method="post" id="stu_course">
                <table class="table1">
                    <tr class="row1"> <td class="row_label">Course ID:</td>
                        <td class="input_data"><select class="input data" name="Course" id="Course">
                                <?php 
//get drop down menu with courses
require_once "../../mod/student/mark_view.php";
$mk = new Mark();
$mk->getDropDown();
?>
                            </select> </td>
                    </tr>
                    <tr> <td></td></tr>
                    <tr>
                        <td>  <input class="button1" type="button"  value="View" name="adding" onclick="ajaxPost('/ACTA_project/mod/student/course.php',$('#stu_course').serialize()+'&adding=View')"> </td>
                    </tr>
                </table>
            </form>
        </div>

    </div>
</div>
</body>
Esempio n. 16
0
<?php 
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'modification-form', 'enableAjaxValidation' => false));
?>

	<?php 
echo $form->errorSummary($model);
echo $form->dropDownListRow($model, 'markname', CHtml::listData(Mark::model()->findAll(), 'id', 'name'), array('data-url' => Yii::app()->createUrl('modification/models'), 'data-model_id' => $model->model_id, 'name' => 'Modification_markname'));
echo $form->dropDownListRow($model, 'modelname', array(), array('name' => 'Modification[model_id]'));
echo $form->textAreaRow($model, 'name', array('rows' => 6, 'cols' => 50, 'class' => 'span8'));
echo $form->textFieldRow($model, 'secode', array('class' => 'span5', 'maxlength' => 4));
echo $form->checkBoxRow($model, 'pop');
?>

	<div class="form-actions">
		<?php 
$this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'submit', 'type' => 'primary', 'label' => $model->isNewRecord ? 'Создать' : 'Сохранить'));
?>
	</div>

<?php 
$this->endWidget();
?>

<script>
	$('#Modification_markname option[value="<?php 
echo Mark::model()->findByPk(Models::model()->findByPk($model->model_id)->mark_id)->id;
?>
"]').attr('selected', 'selected');
	$('body').addClass('modification_update_form');
</script>
Esempio n. 17
0
 /**
  * Compare to mark.
  * $a op $b : return -1 if $a < $b, 0 if $a == $b, and 1 if $a > $b. We
  * compare the difference between $start and $stop, i.e. we call the diff()
  * method.
  *
  * @param   \Hoa\Bench\Mark  $mark    The mark to compare to.
  * @return  int
  */
 public function compareTo(Mark $mark)
 {
     $a = $this->diff();
     $b = $mark->diff();
     if ($a < $b) {
         return -1;
     } elseif ($a == $b) {
         return 0;
     } else {
         return 1;
     }
 }
Esempio n. 18
0
 /**
  * Method for saving Flex models.Mark.
  * @param POST jsonData - holds the markData information in JSON format
  */
 public function addMark()
 {
     if (!($jsonData = $this->input->post('jsonData'))) {
         return;
     }
     $this->load->model('mark');
     $this->load->model('script');
     $this->load->library('json');
     $decoded = $this->json->decode($jsonData);
     $script = new Script();
     $script->setKey($decoded->script);
     $mark = new Mark();
     $mark->setKey($script->getKey());
     $mark->retrieve();
     // make sure the marker has right to mark this
     if ($mark->get('marker') !== $this->_getUser()) {
         $this->_flexResult(I_FlexMarksIn::NOT_AUTH);
         return;
     }
     // store data
     $mark->set('markData', $jsonData);
     $mark->set('targets', serialize($decoded->targets));
     $mark->set('generalComment', $decoded->generalComment);
     // change status
     $mark->submit();
     if (!$mark->update()) {
         // @todo add some Flex handeling for this if it occurs
         $this->_flexResult(I_FlexMarksIn::ERROR);
         return;
     }
     // set script's status to marked
     $script->marked();
     $script->update();
     // get the script data to use in the email
     $script->retrieve();
     $customerEmail = $script->get('email');
     $scriptID = $script->getKey();
     $lastPage = count($script->pages->getPageKeys());
     // save an email for the customers, to be send by cron task
     $subject = 'A tutor has read your exam essay and provided feedback';
     foreach ($decoded->targets as $target) {
         $newTarget['type'] = $target->type;
         $newTarget['text'] = $target->text;
         $emailData['targets'][] = $newTarget;
     }
     $emailData['generalComment'] = $decoded->generalComment;
     // link for user to launch flex viewer
     $emailData['viewURL'] = site_url("/user/scripts/viewfeedback/{$scriptID}/{$lastPage}");
     $msg = $this->load->view('email/marked', $emailData, true);
     $this->load->model('email');
     $this->email->set('sender', '*****@*****.**');
     $this->email->set('receiver', $customerEmail);
     $this->email->set('subject', $subject);
     $this->email->set('message', $msg);
     //$this->email->set('messageHTML',$msgHTML);
     $this->email->create();
     $this->_flexResult(I_FlexMarksIn::SAVE_SUCCESSFUL);
 }
 /**
  * Update the specified resource in storage.
  * PUT /frontend/publiccontact/{id}
  *
  * @param  int  $id
  * @return Response
  */
 public function oceni($id)
 {
     try {
         if (!Session::get('id')) {
             return Redirect::to(Request::root() . '/login?ref=' . rawurlencode("ljudi/" . $id));
         } else {
             $contact = Contact::findOrFail($id);
             $update = false;
             try {
                 $mark = Mark::where('people_id', '=', $id)->where('user_id', '=', Session::get('id'))->firstOrFail();
                 $update = true;
             } catch (Exception $e) {
                 $mark = new Mark();
             }
             $mark->user_id = Session::get('id');
             $mark->people_id = $id;
             $mark->uskladjenost = Input::get('uskladjenost');
             $mark->jasnost = Input::get('jasnost');
             $mark->interakcija = Input::get('interakcija');
             $mark->komunikacija = Input::get('komunikacija');
             $mark->konflikt = Input::get('konflikt');
             $mark->inspiracija = Input::get('inspiracija');
             $mark->aktivnost = Input::get('aktivnost');
             $mark->kvalitet_literature = Input::get('literatura');
             $mark->student_relations = Input::get('odnos');
             $avg = ($mark->uskladjenost + $mark->jasnost + $mark->interakcija + $mark->komunikacija + (11 - $mark->konflikt) + $mark->inspiracija + $mark->aktivnost + $mark->kvalitet_literature + $mark->student_relations) / 9;
             $mark->total_impression = $avg;
             $mark->note = Input::get('komentar');
             $mark->save();
             $mark_count = Mark::where('people_id', '=', $id)->count();
             $contact->mark_count++;
             $contact->uskladjenost = ($contact->uskladjenost * ($mark_count - 1) + $mark->uskladjenost) / $mark_count;
             $contact->jasnost = ($contact->jasnost * ($mark_count - 1) + $mark->jasnost) / $mark_count;
             $contact->interakcija = ($contact->interakcija * ($mark_count - 1) + $mark->interakcija) / $mark_count;
             $contact->komunikacija = ($contact->komunikacija * ($mark_count - 1) + $mark->komunikacija) / $mark_count;
             $contact->konflikt = ($contact->konflikt * ($mark_count - 1) + $mark->konflikt) / $mark_count;
             $contact->inspiracija = ($contact->inspiracija * ($mark_count - 1) + $mark->inspiracija) / $mark_count;
             $contact->aktivnost = ($contact->aktivnost * ($mark_count - 1) + $mark->aktivnost) / $mark_count;
             $contact->kvalitet_literature = ($contact->kvalitet_literature * ($mark_count - 1) + $mark->kvalitet_literature) / $mark_count;
             $contact->student_relations = ($contact->student_relations * ($mark_count - 1) + $mark->student_relations) / $mark_count;
             $contact->total_impression = ($contact->total_impression * ($mark_count - 1) + $mark->total_impression) / $mark_count;
             $contact->save();
             if ($update) {
                 return Redirect::to(Request::root() . '/ljudi/' . $id)->with('notif', 'success')->with('message', __("Оцена предавача ажурирана"));
             }
             return Redirect::to(Request::root() . '/ljudi/' . $id)->with('notif', 'success')->with('message', __("Успешно сте оценили предавача"));
         }
     } catch (Exception $e) {
         return Redirect::to(Request::root() . '/ljudi/' . $id)->with('notif', 'danger')->with('message', __("Одабрани предавач не постоји"));
     }
 }
Esempio n. 20
0
 /**
  * This is the default 'index' action that is invoked
  * when an action is not explicitly requested by users.
  */
 public function actionIndex()
 {
     $data = Mark::getAllMarks();
     $this->render('index', array('data' => $data));
 }
Esempio n. 21
0
</h1>

<?php 
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'models-form', 'enableAjaxValidation' => false));
?>

	<?php 
echo $form->errorSummary($model);
?>

	<?php 
echo $form->textFieldRow($model, 'name', array('class' => 'span5', 'maxlength' => 256));
?>

	<?php 
echo $form->dropDownListRow($model, 'mark_id', CHtml::listData(Mark::model()->findAll(), 'id', 'name'), array('data-url' => Yii::app()->createUrl('modification/models'), 'name' => 'Models[mark_id]'));
?>

	<?php 
echo $form->checkBoxRow($model, 'pop');
?>

	<div class="form-actions">
		<?php 
$this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'submit', 'type' => 'primary', 'label' => $model->isNewRecord ? 'Создать' : 'Сохранить'));
?>
	</div>

<?php 
$this->endWidget();
?>
Esempio n. 22
0
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = Mark::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }