本文整理匯總了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;
}