本文整理汇总了PHP中Kronolith::validateUserAttendee方法的典型用法代码示例。如果您正苦于以下问题:PHP Kronolith::validateUserAttendee方法的具体用法?PHP Kronolith::validateUserAttendee怎么用?PHP Kronolith::validateUserAttendee使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kronolith
的用法示例。
在下文中一共展示了Kronolith::validateUserAttendee方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: switch
$actionID = Horde_Util::getFormData('actionID');
if (Horde_Util::getFormData('clearAll')) {
$actionID = 'clear';
}
$actionValue = Horde_Util::getFormData('actionValue');
// Perform the specified action, if there is one.
switch ($actionID) {
case 'add':
// Add new attendees and/or resources. Multiple attendees can be seperated
// on a single line by whitespace and/or commas. Resources are added one
// at a time (at least for now).
$newUser = trim(Horde_Util::getFormData('newUser'));
$newAttendees = trim(Horde_Util::getFormData('newAttendees'));
$newResource = trim(Horde_Util::getFormData('resourceselect'));
if (!is_null($newUser)) {
if (!($user = Kronolith::validateUserAttendee($newUser))) {
$notification->push(sprintf(_("The user \"%s\" does not exist."), $newUser), 'horde.error');
} else {
$attendees->add($user);
}
}
$newAttendees = Kronolith_Attendee_List::parse($newAttendees, $notification);
$session->set('kronolith', 'attendees', $attendees->add($newAttendees));
// Any new resources?
if (!empty($newResource)) {
/* Get the requested resource */
$resource = Kronolith::getDriver('Resource')->getResource($newResource);
/* Do our best to see what the response will be. Note that this
* response is only guarenteed once the event is saved. */
$event = Kronolith::getDriver()->getEvent();
$event->start = $start;
示例2: readForm
/**
* Reads form/post data and updates this event's properties.
*
* @param Kronolith_Event|null $existing If this is an exception event
* this is taken as the base event.
* @since 4.2.6
*
*/
public function readForm(Kronolith_Event $existing = null)
{
global $notification, $prefs, $registry, $session;
// Event owner.
$targetcalendar = Horde_Util::getFormData('targetcalendar');
if (strpos($targetcalendar, '\\')) {
list(, $this->creator) = explode('\\', $targetcalendar, 2);
} elseif (!isset($this->_id)) {
$this->creator = $registry->getAuth();
}
// Basic fields.
$this->title = Horde_Util::getFormData('title', $this->title);
$this->description = Horde_Util::getFormData('description', $this->description);
$this->location = Horde_Util::getFormData('location', $this->location);
$this->timezone = Horde_Util::getFormData('timezone', $this->timezone);
$this->private = (bool) Horde_Util::getFormData('private');
// if the field is empty you are the organizer (and so organizer should be null)
$this->organizer = Horde_Util::getFormData('organizer', $this->organizer) ?: null;
// URL.
$url = Horde_Util::getFormData('eventurl', $this->url);
if (strlen($url)) {
// Analyze and re-construct.
$url = @parse_url($url);
if ($url) {
if (function_exists('http_build_url')) {
if (empty($url['path'])) {
$url['path'] = '/';
}
$url = http_build_url($url);
} else {
$new_url = '';
if (isset($url['scheme'])) {
$new_url .= $url['scheme'] . '://';
}
if (isset($url['user'])) {
$new_url .= $url['user'];
if (isset($url['pass'])) {
$new_url .= ':' . $url['pass'];
}
$new_url .= '@';
}
if (isset($url['host'])) {
// Convert IDN hosts to ASCII.
if (function_exists('idn_to_ascii')) {
$url['host'] = @idn_to_ascii($url['host']);
} elseif (Horde_Mime::is8bit($url['host'])) {
//throw new Kronolith_Exception(_("Invalid character in URL."));
$url['host'] = '';
}
$new_url .= $url['host'];
}
if (isset($url['path'])) {
$new_url .= $url['path'];
}
if (isset($url['query'])) {
$new_url .= '?' . $url['query'];
}
if (isset($url['fragment'])) {
$new_url .= '#' . $url['fragment'];
}
$url = $new_url;
}
}
}
$this->url = $url;
// Status.
$this->status = Horde_Util::getFormData('status', $this->status);
// Attendees.
$attendees = $session->get('kronolith', 'attendees');
if (!$attendees) {
$attendees = new Kronolith_Attendee_List();
}
$newattendees = Horde_Util::getFormData('attendees');
$userattendees = Horde_Util::getFormData('users');
if (!is_null($newattendees) || !is_null($userattendees)) {
if ($newattendees) {
$newattendees = Kronolith_Attendee_List::parse(trim($newattendees), $notification);
} else {
$newattendees = new Kronolith_Attendee_List();
}
if ($userattendees) {
foreach (explode(',', $userattendees) as $user) {
if (!($newUser = Kronolith::validateUserAttendee($user))) {
$notification->push(sprintf(_("The user \"%s\" does not exist."), $newUser), 'horde.error');
} else {
$newattendees->add($newUser);
}
}
}
// First add new attendees missing in the current list.
foreach ($newattendees as $attendee) {
if (!$attendees->has($attendee)) {
//.........这里部分代码省略.........