-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1093 from oat-sa/release-7.36.2
Release 7.36.2
- Loading branch information
Showing
56 changed files
with
2,249 additions
and
1,205 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
<?php | ||
/** | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* as published by the Free Software Foundation; under version 2 | ||
* of the License (non-upgradable). | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
* | ||
*/ | ||
|
||
use oat\oatbox\task\Queue; | ||
use oat\oatbox\task\Task; | ||
|
||
/** | ||
* Rest API controller for task queue | ||
* | ||
* Class tao_actions_TaskQueue | ||
* @package oat\tao\controller\api | ||
* @author Aleh Hutnikau, <[email protected]> | ||
*/ | ||
class tao_actions_TaskQueue extends \tao_actions_RestController | ||
{ | ||
const TASK_ID_PARAM = 'id'; | ||
|
||
/** | ||
* Get task data by identifier | ||
*/ | ||
public function get() | ||
{ | ||
try { | ||
if (!$this->hasRequestParameter(self::TASK_ID_PARAM)) { | ||
throw new \common_exception_MissingParameter(self::TASK_ID_PARAM, $this->getRequestURI()); | ||
} | ||
$data = $this->getTaskData($this->getRequestParameter(self::TASK_ID_PARAM)); | ||
$this->returnSuccess($data); | ||
} catch (\Exception $e) { | ||
$this->returnFailure($e); | ||
} | ||
} | ||
|
||
/** | ||
* Template method to generate task data to be returned to the end user. | ||
* @param string $taskId | ||
* @return array | ||
*/ | ||
protected function getTaskData($taskId) | ||
{ | ||
$task = $this->getTask($taskId); | ||
$result['id'] = $this->getTaskId($task); | ||
$result['status'] = $this->getTaskStatus($task); | ||
$result['report'] = $this->getTaskReport($task); | ||
|
||
return $result; | ||
} | ||
|
||
/** | ||
* Get task instance from queue by identifier | ||
* @param $taskId task identifier | ||
* @throws \common_exception_NotFound | ||
* @return Task | ||
*/ | ||
protected function getTask($taskId) | ||
{ | ||
/** @var Queue $taskQueue */ | ||
$taskQueue = $this->getServiceManager()->get(Queue::CONFIG_ID); | ||
$task = $taskQueue->getTask($taskId); | ||
if ($task === null) { | ||
throw new \common_exception_NotFound(__('Task not found')); | ||
} | ||
return $task; | ||
} | ||
|
||
/** | ||
* Return task report. Method may be overridden to comply special format of report | ||
* @param Task $task | ||
* @return null | ||
*/ | ||
protected function getTaskReport(Task $task) | ||
{ | ||
return $task->getReport(); | ||
} | ||
|
||
/** | ||
* Return task status | ||
* @param Task $task | ||
* @return null | ||
*/ | ||
protected function getTaskStatus(Task $task) | ||
{ | ||
return $task->getStatus(); | ||
} | ||
|
||
/** | ||
* Return task identifier | ||
* @param Task $task | ||
* @return null | ||
*/ | ||
protected function getTaskId(Task $task) | ||
{ | ||
return $task->getId(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,7 +46,7 @@ | |
* | ||
* @access public | ||
* @author Dieter Raber, <[email protected]> | ||
* @date 2016-09-27 08:43:02 | ||
* @date 2016-12-02 07:57:18 | ||
* @package tao | ||
* @subpackage helpers | ||
*/ | ||
|
@@ -75,6 +75,8 @@ protected static function buildIcon($icon, $options=array()){ | |
/** | ||
* List of all icons as constant | ||
*/ | ||
const CLASS_COMPRESS = 'icon-compress'; | ||
const CLASS_MAP_O = 'icon-map-o'; | ||
const CLASS_TEXT_MARKER = 'icon-text-marker'; | ||
const CLASS_UNSHIELD = 'icon-unshield'; | ||
const CLASS_SHIELD = 'icon-shield'; | ||
|
@@ -273,6 +275,14 @@ protected static function buildIcon($icon, $options=array()){ | |
* List of all icons as function | ||
*/ | ||
|
||
public static function iconCompress($options=array()){ | ||
return self::buildIcon(self::CLASS_COMPRESS, $options); | ||
} | ||
|
||
public static function iconMapO($options=array()){ | ||
return self::buildIcon(self::CLASS_MAP_O, $options); | ||
} | ||
|
||
public static function iconTextMarker($options=array()){ | ||
return self::buildIcon(self::CLASS_TEXT_MARKER, $options); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<?php | ||
/** | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* as published by the Free Software Foundation; under version 2 | ||
* of the License (non-upgradable). | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
* | ||
* Copyright (c) 2015 (original work) Open Assessment Technologies SA; | ||
* | ||
*/ | ||
|
||
namespace oat\tao\helpers\form\elements; | ||
|
||
use tao_helpers_form_elements_MultipleElement; | ||
use core_kernel_classes_Property; | ||
use core_kernel_classes_Resource; | ||
use tao_helpers_Uri; | ||
use oat\tao\helpers\form\ValidationRuleRegistry; | ||
|
||
/** | ||
* Implementation model selector | ||
* | ||
* @abstract | ||
* @package tao | ||
*/ | ||
abstract class Validators | ||
extends tao_helpers_form_elements_MultipleElement | ||
{ | ||
|
||
/** | ||
* @todo should be a constant | ||
* @var string | ||
*/ | ||
protected $widget = 'http://www.tao.lu/datatypes/WidgetDefinitions.rdf#ValidationSelector'; | ||
|
||
/** | ||
* (non-PHPdoc) | ||
* @see tao_helpers_form_elements_MultipleElement::getOptions() | ||
*/ | ||
public function getOptions() { | ||
$options = parent::getOptions(); | ||
|
||
$statusProperty = new core_kernel_classes_Property(PROPERTY_ABSTRACTMODEL_STATUS); | ||
$current = $this->getEvaluatedValue(); | ||
|
||
$options = array(); | ||
$map = ValidationRuleRegistry::getRegistry()->getMap(); | ||
foreach (ValidationRuleRegistry::getRegistry()->getMap() as $id => $validator) { | ||
$options[$id] = $id; | ||
} | ||
|
||
return $options; | ||
} | ||
|
||
/** | ||
* (non-PHPdoc) | ||
* @see tao_helpers_form_elements_MultipleElement::setValue() | ||
*/ | ||
public function setValue($value) | ||
{ | ||
$this->addValue($value); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
/** | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* as published by the Free Software Foundation; under version 2 | ||
* of the License (non-upgradable). | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
* | ||
* Copyright (c) 2015 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT); | ||
* | ||
* | ||
*/ | ||
namespace oat\tao\helpers\form\elements\xhtml; | ||
|
||
use oat\tao\helpers\form\elements\Validators as AbstractValidators; | ||
|
||
/** | ||
* Based on tao_helpers_form_elements_xhtml_Radiobox | ||
*/ | ||
class Validators extends AbstractValidators | ||
{ | ||
use XhtmlRenderingTrait; | ||
|
||
/** | ||
* | ||
* @see tao_helpers_form_FormElement::render | ||
*/ | ||
public function render() | ||
{ | ||
$returnValue = $this->renderLabel(); | ||
|
||
$i = 0; | ||
$returnValue .= '<div class="form_radlst form_checklst">'; | ||
foreach ($this->getOptions() as $optionId => $optionLabel) { | ||
$returnValue .= "<input type='checkbox' value='{$optionId}' name='{$this->name}[]' id='{$this->name}_{$i}' "; | ||
$returnValue .= $this->renderAttributes(); | ||
|
||
if (in_array($optionId, $this->values)) { | ||
$returnValue .= " checked='checked' "; | ||
} | ||
$returnValue .= " /> <label class='elt_desc' for='{$this->name}_{$i}'>" . _dh($optionLabel) . "</label><br />"; | ||
$i ++; | ||
} | ||
$returnValue .= "</div>"; | ||
|
||
return (string) $returnValue; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.