本文整理汇总了PHP中HookManager::callHooks方法的典型用法代码示例。如果您正苦于以下问题:PHP HookManager::callHooks方法的具体用法?PHP HookManager::callHooks怎么用?PHP HookManager::callHooks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HookManager
的用法示例。
在下文中一共展示了HookManager::callHooks方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Societe
//.........这里部分代码省略.........
$odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
}
} else {
//print $key.' '.$value;exit;
$odfHandler->setVars($key, $value, true, 'UTF-8');
}
} catch (OdfException $e) {
}
}
// Make substitutions into odt of mysoc info
$tmparray = $this->get_substitutionarray_mysoc($mysoc, $outputlangs);
//var_dump($tmparray); exit;
foreach ($tmparray as $key => $value) {
try {
if (preg_match('/logo$/', $key)) {
//var_dump($value);exit;
if (file_exists($value)) {
$odfHandler->setImage($key, $value);
} else {
$odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
}
} else {
$odfHandler->setVars($key, $value, true, 'UTF-8');
}
} catch (OdfException $e) {
}
}
// Make substitutions into odt of thirdparty + external modules
$tmparray = $this->get_substitutionarray_thirdparty($soc, $outputlangs);
//complete_substitutions_array($tmparray, $langs, $object);
//var_dump($object->id); exit;
foreach ($tmparray as $key => $value) {
try {
if (preg_match('/logo$/', $key)) {
if (file_exists($value)) {
$odfHandler->setImage($key, $value);
} else {
$odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
}
} else {
$odfHandler->setVars($key, $value, true, 'UTF-8');
}
} catch (OdfException $e) {
}
}
// Get extra fields for contractid
include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
$hookmanager = new HookManager($this->db);
$hookmanager->callHooks(array('contrat_extrafields'));
$parameters = array('id' => $object->id);
$values = $hookmanager->executeHooks('getFields', $parameters, $object, GETPOST('action'));
// Note that $action and $object may have been modified by hook
if (is_array($values)) {
foreach ($values as $key => $value) {
try {
if (preg_match("/^options_/", $key)) {
$var = substr($key, 8, strlen($key));
// retire options_
$odfHandler->setVars($var, $values[$key], true, 'UTF-8');
}
} catch (OdfException $e) {
}
}
}
// Get extra fields for socid
include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
$hookmanager = new HookManager($this->db);
$hookmanager->callHooks(array('thirdparty_extrafields'));
$parameters = array('id' => $soc->id);
$values = $hookmanager->executeHooks('getFields', $parameters, $soc, GETPOST('action'));
// Note that $action and $object may have been modified by hook
if (is_array($values)) {
foreach ($values as $key => $value) {
try {
if (preg_match("/^options_/", $key)) {
$var = substr($key, 8, strlen($key));
// retire options_
$odfHandler->setVars($var, $values[$key], true, 'UTF-8');
}
} catch (OdfException $e) {
}
}
}
// Write new file
//$result=$odfHandler->exportAsAttachedFile('toto');
$odfHandler->saveToDisk($file);
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
$odfHandler = null;
// Destroy object
return 1;
// Success
} else {
$this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
return -1;
}
}
return -1;
}