本文整理汇总了PHP中TicketValidation::getField方法的典型用法代码示例。如果您正苦于以下问题:PHP TicketValidation::getField方法的具体用法?PHP TicketValidation::getField怎么用?PHP TicketValidation::getField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TicketValidation
的用法示例。
在下文中一共展示了TicketValidation::getField方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: methodsetTicketValidation
/**
* Answer to a ticket validation request
* for an authenticated user
*
* @param $params array of options (ticket, id2name)
* @param $protocol the communication protocol used
*
* @return array of hashtable as glpi.getTicket
**/
static function methodsetTicketValidation($params, $protocol)
{
global $DB, $CFG_GLPI;
if (isset($params['help'])) {
return array('approval' => 'integer,mandatory', 'id2name' => 'bool,optional', 'status' => 'text,mandatory', 'comment' => 'text,optional', 'help' => 'bool,optional');
}
if (!Session::getLoginUserID()) {
return self::Error($protocol, WEBSERVICES_ERROR_NOTAUTHENTICATED);
}
$ticket = new Ticket();
if (!isset($params['approval'])) {
return self::Error($protocol, WEBSERVICES_ERROR_MISSINGPARAMETER, '', 'approval');
}
if (!isset($params['status'])) {
return self::Error($protocol, WEBSERVICES_ERROR_MISSINGPARAMETER, '', 'status');
}
$tabstatus = TicketValidation::getAllStatusArray();
if (!isset($tabstatus[$params['status']])) {
return self::Error($protocol, WEBSERVICES_ERROR_BADPARAMETER, '', 'status=' . $params['status']);
}
if ($params['status'] == 'rejected' && !isset($params['comment'])) {
return self::Error($protocol, WEBSERVICES_ERROR_MISSINGPARAMETER, '', 'comment');
}
$valid = new TicketValidation();
if (!$valid->getFromDB($params['approval'])) {
return self::Error($protocol, WEBSERVICES_ERROR_NOTFOUND, '', 'approval');
}
$input = array('id' => $valid->getField('id'), 'status' => $params['status']);
if (isset($params['comment'])) {
$input['comment_validation'] = addslashes($params['comment']);
}
if (!$valid->can($params['approval'], 'w')) {
return self::Error($protocol, WEBSERVICES_ERROR_NOTALLOWED);
}
if ($valid->update($input)) {
unset($params['approval'], $params['status'], $params['comment']);
$params['ticket'] = $valid->getField('tickets_id');
return self::methodGetTicket($params, $protocol);
}
return self::Error($protocol, WEBSERVICES_ERROR_FAILED, '', self::getDisplayError());
}