本文整理匯總了PHP中CTemplate::error方法的典型用法代碼示例。如果您正苦於以下問題:PHP CTemplate::error方法的具體用法?PHP CTemplate::error怎麽用?PHP CTemplate::error使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CTemplate
的用法示例。
在下文中一共展示了CTemplate::error方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: template
private static function template($action, $params)
{
CTemplate::$error = array();
switch ($action) {
default:
$result = call_user_func(array('CTemplate', $action), $params);
}
self::$result = $result;
}
示例2: template
private static function template($action, $params)
{
CTemplate::$error = array();
switch ($action) {
case 'add':
$result = CTemplate::add($params);
break;
case 'get':
$result = CTemplate::get($params);
break;
case 'getById':
$result = CTemplate::getById($params);
break;
case 'getId':
$result = CTemplate::getId($params);
break;
case 'update':
$result = CTemplate::update($params);
break;
case 'linkHosts':
$result = CTemplate::linkHosts($params);
break;
case 'unlinkHosts':
$result = CTemplate::unlinkHosts($params);
break;
case 'linkTemplates':
$result = CTemplate::linkTemplates($params);
break;
case 'unlinkTemplates':
$result = CTemplate::unlinkTemplates($params);
break;
case 'delete':
$result = CTemplate::delete($params);
break;
default:
self::$result = array('error' => ZBX_API_ERROR_NO_METHOD, 'data' => 'Method: "' . $action . '" doesn\'t exist.');
return;
//exit function
}
if ($result !== false) {
self::$result = array('result' => $result);
} else {
self::$result = CTemplate::$error;
}
}
示例3: unlinkTemplates
/**
* Unlink Templates from Host
*
* {@source}
* @access public
* @static
* @since 1.8
* @version 1
*
* @param string $data
* @param string $data['templateid']
* @param array $data['hostids']
* @param boolean $data['clean'] whether to wipe all info from template elements.
* @return boolean
*/
public static function unlinkTemplates($data)
{
$templateid = $data['templateid'];
$hostids = $data['hostids'];
$clean = isset($data['clean']);
$result = delete_template_elements($hostid, $templateids, $clean);
$result &= DBexecute('DELETE FROM hosts_templates WHERE hostid=' . $hostid . ' AND ' . DBcondition('templateid', $templateids));
if ($result) {
return true;
} else {
self::$error = array('error' => ZBX_API_ERROR_INTERNAL, 'data' => $error);
return false;
}
}