96 lines
2.0 KiB
PHP
96 lines
2.0 KiB
PHP
<?php
|
|
class Scores_Exec_Ref
|
|
{
|
|
protected $code;
|
|
|
|
/**
|
|
* Enregistrement de l'execution d'un programme par son code
|
|
* @param string $code
|
|
*/
|
|
public function __construct($code)
|
|
{
|
|
$this->code = $code;
|
|
}
|
|
|
|
/**
|
|
* Marqueur de démarrage
|
|
*/
|
|
public function start()
|
|
{
|
|
$data = array(
|
|
'code' => $this->code,
|
|
'dateStart' => date('YmdHis'),
|
|
);
|
|
|
|
$model = new Application_Model_ExecutionProcessOut();
|
|
try {
|
|
$id = $model->insert($data);
|
|
} catch(Zend_Db_Exception $e) {
|
|
return null;
|
|
}
|
|
|
|
return $id;
|
|
}
|
|
|
|
/**
|
|
* Marqueur du nombre d'éléments à traiter
|
|
* @param int $id
|
|
* @param int $num
|
|
*/
|
|
public function total($id, $num)
|
|
{
|
|
$data = array('unitTotal' => $num);
|
|
$model = new Application_Model_ExecutionProcessOut();
|
|
try {
|
|
$result = $model->update($data, 'id='.$id);
|
|
} catch(Zend_Db_Exception $e) {
|
|
return false;
|
|
}
|
|
|
|
return $result;
|
|
}
|
|
|
|
/**
|
|
* Marqueur increment
|
|
* @param int $id
|
|
* @param int $num
|
|
* @return boolean|int
|
|
*/
|
|
public function increment($id, $num)
|
|
{
|
|
$data = array(
|
|
'unitExec' => $num,
|
|
'updated' => date('YmdHis'),
|
|
);
|
|
|
|
$model = new Application_Model_ExecutionProcessOut();
|
|
try {
|
|
$result = $model->update($data, 'id='.$id);
|
|
} catch(Zend_Db_Exception $e) {
|
|
return false;
|
|
}
|
|
|
|
return $result;
|
|
}
|
|
|
|
/**
|
|
* Marqueur de fin
|
|
* @param int $id
|
|
* @return boolean|int
|
|
*/
|
|
public function end($id)
|
|
{
|
|
$data = array(
|
|
'dateEnd' => date('YmdHis'),
|
|
);
|
|
|
|
$model = new Application_Model_ExecutionProcessOut();
|
|
try {
|
|
$result = $model->update($data, 'id='.$id);
|
|
} catch(Zend_Db_Exception $e) {
|
|
return false;
|
|
}
|
|
|
|
return $result;
|
|
}
|
|
} |