Merged in mcuiza/processmaker/PM-4099 (pull request #3177)

PM-4099
This commit is contained in:
Julio Cesar Laura Avendaño
2015-11-19 19:25:53 -04:00
3 changed files with 77 additions and 3 deletions

View File

@@ -396,6 +396,25 @@ class PMPlugin
throw $e;
}
}
/**
* Changes the menu properties from the given processmaker section and menu id
*
* @param array $from
*
* @param array $options
*
* @return void
*/
public function registerMenuOptionsToReplace($from = array(), $options = array())
{
try {
$oPluginRegistry =& PMPluginRegistry::getSingleton();
$oPluginRegistry->registerMenuOptionsToReplace($this->sNamespace, $from, $options);
} catch (Exception $e) {
throw $e;
}
}
}
class menuDetail
@@ -735,4 +754,3 @@ class cronFile
$this->cronFile = $cronFile;
}
}

View File

@@ -102,6 +102,7 @@ class PMPluginRegistry
private $_aDashboardPages = array ();
private $_aCronFiles = array ();
private $_arrayDesignerMenu = array();
private $_aMenuOptionsToReplace = array ();
/**
* Registry a plugin javascript to include with js core at same runtime
@@ -403,7 +404,11 @@ class PMPluginRegistry
unset($this->_arrayDesignerMenu[$key]);
}
}
if(sizeof( $this->_aMenuOptionsToReplace )){
unset( $this->_aMenuOptionsToReplace );
}
//unregistering javascripts from this plugin
$this->unregisterJavascripts( $sNamespace );
//unregistering rest services from this plugin
@@ -1659,5 +1664,43 @@ class PMPluginRegistry
throw $e;
}
}
/**
* Replace new options to menu
*
* @param unknown_type $namespace
*
* @param array $from
*
* @param array $options
*
* @return void
*/
public function registerMenuOptionsToReplace ($namespace, $from, $options)
{
if(isset($from["section"]) && isset($from["menuId"])) {
$section = $from["section"];
$oMenuFromPlugin = $this->_aMenuOptionsToReplace;
if(array_key_exists($section,$oMenuFromPlugin)) {
unset($this->_aMenuOptionsToReplace[$from["section"]]);
}
$this->_aMenuOptionsToReplace[$from["section"]][$from["menuId"]][] = $options;
}
}
/**
* Return all menu Options from a specific section
*
* @return array
*/
public function getMenuOptionsToReplace($strMenuName)
{
$oMenuFromPlugin = $this->_aMenuOptionsToReplace;
if(sizeof($oMenuFromPlugin)) {
if(array_key_exists($strMenuName,$oMenuFromPlugin)) {
return $oMenuFromPlugin[$strMenuName];
}
}
}
}