diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/Action/Base.php | 11 | ||||
-rw-r--r-- | app/Model/Action.php | 26 |
2 files changed, 36 insertions, 1 deletions
diff --git a/app/Action/Base.php b/app/Action/Base.php index d0c81d89..c8ff02a4 100644 --- a/app/Action/Base.php +++ b/app/Action/Base.php @@ -127,6 +127,17 @@ abstract class Base extends \Core\Base } /** + * Get project id + * + * @access public + * @return integer + */ + public function getProjectId() + { + return $this->project_id; + } + + /** * Set an user defined parameter * * @access public diff --git a/app/Model/Action.php b/app/Model/Action.php index 87058cce..57bd5b0d 100644 --- a/app/Model/Action.php +++ b/app/Model/Action.php @@ -31,6 +31,28 @@ class Action extends Base const TABLE_PARAMS = 'action_has_params'; /** + * Extended actions + * + * @access private + * @var array + */ + private $actions = array(); + + /** + * Extend the list of default actions + * + * @access public + * @param string $className + * @param string $description + * @return Action + */ + public function extendActions($className, $description) + { + $this->actions[$className] = $description; + return $this; + } + + /** * Return the name and description of available actions * * @access public @@ -62,6 +84,8 @@ class Action extends Base 'TaskAssignColorLink' => t('Change task color when using a specific task link'), ); + $values = array_merge($values, $this->actions); + asort($values); return $values; @@ -296,7 +320,7 @@ class Action extends Base */ public function load($name, $project_id, $event) { - $className = '\Action\\'.$name; + $className = $name{0} !== '\\' ? '\Action\\'.$name : $name; return new $className($this->container, $project_id, $event); } |