本文整理汇总了PHP中Kronolith类的典型用法代码示例。如果您正苦于以下问题:PHP Kronolith类的具体用法?PHP Kronolith怎么用?PHP Kronolith使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Kronolith类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* @throws Kronolith_Exception
*/
public function execute()
{
if ($this->_vars->get('submitbutton') == _("Cancel")) {
Horde::url($GLOBALS['prefs']->getValue('defaultview') . '.php', true)->redirect();
}
return Kronolith::unsubscribeRemoteCalendar($this->_vars->get('url'));
}
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:10,代码来源:UnsubscribeRemoteCalendar.php
示例2: _addBaseVars
/**
* Add base javascript variables to the page.
*/
protected function _addBaseVars()
{
global $conf, $injector, $prefs, $registry;
$auth_name = $registry->getAuth();
$has_tasks = Kronolith::hasApiPermission('tasks');
$identity = $injector->getInstance('Horde_Core_Factory_Identity')->create();
$app_urls = $js_vars = array();
if (isset($conf['menu']['apps']) && is_array($conf['menu']['apps'])) {
foreach ($conf['menu']['apps'] as $app) {
$app_urls[$app] = strval(Horde::url($registry->getInitialPage($app), true));
}
}
/* Variables used in core javascript files. */
$js_vars['conf'] = array_filter(array('URI_CALENDAR_EXPORT' => str_replace(array('%23', '%2523', '%7B', '%257B', '%7D', '%257D'), array('#', '#', '{', '{', '}', '}'), strval($registry->downloadUrl('#{calendar}.ics', array('actionID' => 'export', 'all_events' => 1, 'exportID' => Horde_Data::EXPORT_ICALENDAR, 'exportCal' => 'internal_#{calendar}'))->setRaw(true))), 'URI_RESOURCE_EXPORT' => str_replace(array('%23', '%2523', '%7B', '%257B', '%7D', '%257D'), array('#', '#', '{', '{', '}', '}'), strval($registry->downloadUrl('#{calendar}.ics', array('actionID' => 'export', 'all_events' => 1, 'exportID' => Horde_Data::EXPORT_ICALENDAR, 'exportCal' => 'resource_#{calendar}'))->setRaw(true))), 'URI_EVENT_EXPORT' => str_replace(array('%23', '%7B', '%7D'), array('#', '{', '}'), Horde::url('event.php', true)->add(array('view' => 'ExportEvent', 'eventID' => '#{id}', 'calendar' => '#{calendar}', 'type' => '#{type}'))), 'images' => array('alarm' => strval(Horde_Themes::img('alarm-fff.png')), 'attendees' => strval(Horde_Themes::img('attendees-fff.png')), 'exception' => strval(Horde_Themes::img('exception-fff.png')), 'new_event' => strval(Horde_Themes::img('new.png')), 'new_task' => strval(Horde_Themes::img('new_task.png')), 'recur' => strval(Horde_Themes::img('recur-fff.png'))), 'new_event' => $injector->getInstance('Kronolith_View_Sidebar')->newLink . $injector->getInstance('Kronolith_View_Sidebar')->newText . '</a>', 'new_task' => $injector->getInstance('Kronolith_View_SidebarTasks')->newLink . $injector->getInstance('Kronolith_View_SidebarTasks')->newText . '</a>', 'user' => $registry->convertUsername($auth_name, false), 'name' => $identity->getName(), 'email' => strval($identity->getDefaultFromAddress()), 'prefs_url' => strval($registry->getServiceLink('prefs', 'kronolith')->setRaw(true)), 'app_urls' => $app_urls, 'name' => $registry->get('name'), 'has_tasks' => intval($has_tasks), 'has_resources' => intval(!empty($conf['resource']['driver'])), 'login_view' => $prefs->getValue('defaultview') == 'workweek' ? 'week' : $prefs->getValue('defaultview'), 'default_calendar' => 'internal|' . Kronolith::getDefaultCalendar(Horde_Perms::EDIT), 'max_events' => intval($prefs->getValue('max_events')), 'date_format' => Horde_Core_Script_Package_Datejs::translateFormat(Horde_Nls::getLangInfo(D_FMT)), 'time_format' => $prefs->getValue('twentyFour') ? 'HH:mm' : 'hh:mm tt', 'import_file' => Horde_Data::IMPORT_FILE, 'import_url' => Horde_Data::IMPORT_URL, 'show_time' => Kronolith::viewShowTime(), 'default_alarm' => intval($prefs->getValue('default_alarm')), 'status' => array('cancelled' => Kronolith::STATUS_CANCELLED, 'confirmed' => Kronolith::STATUS_CONFIRMED, 'free' => Kronolith::STATUS_FREE, 'tentative' => Kronolith::STATUS_TENTATIVE), 'recur' => array(Horde_Date_Recurrence::RECUR_NONE => 'None', Horde_Date_Recurrence::RECUR_DAILY => 'Daily', Horde_Date_Recurrence::RECUR_WEEKLY => 'Weekly', Horde_Date_Recurrence::RECUR_MONTHLY_DATE => 'Monthly', Horde_Date_Recurrence::RECUR_MONTHLY_WEEKDAY => 'Monthly', Horde_Date_Recurrence::RECUR_YEARLY_DATE => 'Yearly', Horde_Date_Recurrence::RECUR_YEARLY_DAY => 'Yearly', Horde_Date_Recurrence::RECUR_YEARLY_WEEKDAY => 'Yearly'), 'perms' => array('all' => Horde_Perms::ALL, 'show' => Horde_Perms::SHOW, 'read' => Horde_Perms::READ, 'edit' => Horde_Perms::EDIT, 'delete' => Horde_Perms::DELETE, 'delegate' => Kronolith::PERMS_DELEGATE), 'tasks' => $has_tasks ? $registry->tasks->ajaxDefaults() : null));
/* Make sure this value is not optimized out by array_filter(). */
$js_vars['conf']['week_start'] = intval($prefs->getValue('week_start_monday'));
/* Gettext strings. */
$js_vars['text'] = array('alarm' => _("Alarm:"), 'alerts' => _("Notifications"), 'allday' => _("All day"), 'delete_calendar' => _("Are you sure you want to delete this calendar and all the events in it?"), 'delete_tasklist' => _("Are you sure you want to delete this task list and all the tasks in it?"), 'external_category' => _("Other events"), 'fix_form_values' => _("Please enter correct values in the form first."), 'geocode_error' => _("Unable to locate requested address"), 'hidelog' => _("Hide Notifications"), 'import_warning' => _("Importing calendar data. This may take a while..."), 'more' => _("more..."), 'no_assignee' => _("None"), 'no_calendar_title' => _("The calendar title must not be empty."), 'no_parent' => _("No parent task"), 'no_tasklist_title' => _("The task list title must not be empty."), 'no_url' => _("You must specify a URL."), 'prefs' => _("Preferences"), 'searching' => sprintf(_("Events matching \"%s\""), '#{term}'), 'shared' => _("Shared"), 'tasks' => _("Tasks"), 'unknown_resource' => _("Unknown resource."), 'wrong_auth' => _("The authentication information you specified wasn't accepted."), 'wrong_date_format' => sprintf(_("You used an unknown date format \"%s\". Please try something like \"%s\"."), '#{wrong}', '#{right}'), 'wrong_time_format' => sprintf(_("You used an unknown time format \"%s\". Please try something like \"%s\"."), '#{wrong}', '#{right}'));
for ($i = 1; $i <= 12; ++$i) {
$js_vars['text']['month'][$i - 1] = Horde_Nls::getLangInfo(constant('MON_' . $i));
}
for ($i = 1; $i <= 7; ++$i) {
$js_vars['text']['weekday'][$i] = Horde_Nls::getLangInfo(constant('DAY_' . $i));
}
foreach (array_diff(array_keys($js_vars['conf']['recur']), array(Horde_Date_Recurrence::RECUR_NONE)) as $recurType) {
$js_vars['text']['recur'][$recurType] = Kronolith::recurToString($recurType);
}
$js_vars['text']['recur']['exception'] = _("Exception");
// Maps
$js_vars['conf']['maps'] = $conf['maps'];
return $js_vars;
}
开发者ID:jubinpatel,项目名称:horde,代码行数:35,代码来源:Ajax.php
示例3: execute
/**
* @throws Kronolith_Exception
*/
public function execute()
{
if ($this->_vars->get('submitbutton') == _("Cancel")) {
Horde::url($GLOBALS['prefs']->getValue('defaultview') . '.php', true)->redirect();
}
Kronolith::deleteShare($this->_calendar);
}
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:10,代码来源:DeleteCalendar.php
示例4: addResource
/**
* Adds a new resource to storage
*
* @param Kronolith_Resource_Base $resource
*
* @return unknown_type
*/
public static function addResource(Kronolith_Resource_Base $resource)
{
// Create a new calendar id.
$calendar = uniqid(mt_rand());
$resource->set('calendar', $calendar);
$driver = Kronolith::getDriver('Resource');
return $driver->save($resource);
}
开发者ID:jubinpatel,项目名称:horde,代码行数:15,代码来源:Resource.php
示例5: createDefaultShare
/**
* Create the default calendar share for the current user.
*
* @return Horde_Share_Object The new default share.
*/
public function createDefaultShare()
{
$share = $this->_shares->newShare($this->_user, strval(new Horde_Support_Randomid()), $this->_getDefaultShareName());
$share->set('color', Kronolith::randomColor());
$this->_prepareDefaultShare($share);
$this->_shares->addShare($share);
return $share;
}
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:13,代码来源:Base.php
示例6: _getAddressbookSearchParams
/**
*/
protected function _getAddressbookSearchParams()
{
$params = Kronolith::getAddressbookSearchParams();
$ob = new stdClass();
$ob->fields = $params['fields'];
$ob->sources = $params['sources'];
return $ob;
}
开发者ID:jubinpatel,项目名称:horde,代码行数:10,代码来源:ContactAutoCompleter.php
示例7: execute
/**
* @throws Kronolith_Exception
*/
public function execute()
{
$info = array();
foreach (array('name', 'color', 'description', 'tags', 'system') as $key) {
$info[$key] = $this->_vars->get($key);
}
return Kronolith::addShare($info);
}
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:11,代码来源:CreateCalendar.php
示例8: setUpBeforeClass
public static function setUpBeforeClass()
{
return;
parent::setUpBeforeClass();
self::createKolabShares(self::$setup);
list($share, $other_share) = self::_createDefaultShares();
self::$driver = Kronolith::getDriver('Kolab', $share->getName());
self::$type = 'Kolab';
}
开发者ID:raz0rsdge,项目名称:horde,代码行数:9,代码来源:KolabTest.php
示例9: _check_max
function _check_max()
{
$perms = $GLOBALS['injector']->getInstance('Horde_Core_Perms');
if ($perms->hasAppPermission('max_events') !== true && $perms->hasAppPermission('max_events') <= Kronolith::countEvents()) {
Horde::permissionDeniedError('kronolith', 'max_events', sprintf(_("You are not allowed to create more than %d events."), $perms->hasAppPermission('max_events')));
return false;
}
return true;
}
开发者ID:jubinpatel,项目名称:horde,代码行数:9,代码来源:edit.php
示例10: setUpBeforeClass
public static function setUpBeforeClass()
{
self::$callback = array(__CLASS__, 'getDb');
parent::setUpBeforeClass();
$migrator = new Horde_Db_Migration_Migrator($GLOBALS['injector']->getInstance('Horde_Db_Adapter'), null, array('migrationsPath' => __DIR__ . '/../../../../../../migration', 'schemaTableName' => 'kronolith_test_schema'));
$migrator->up();
list($share, $other_share) = self::_createDefaultShares();
self::$driver = Kronolith::getDriver('Sql', $share->getName());
self::$type = 'Sql';
}
开发者ID:jubinpatel,项目名称:horde,代码行数:10,代码来源:SqliteTest.php
示例11: execute
/**
* @throws Kronolith_Exception
*/
public function execute()
{
switch ($this->_vars->submitbutton) {
case _("Save"):
$new_name = $this->_vars->get('name');
$this->_resource->set('name', $new_name);
$this->_resource->set('description', $this->_vars->get('description'));
$this->_resource->set('response_type', $this->_vars->get('responsetype'));
$this->_resource->set('email', $this->_vars->get('email'));
/* Update group memberships */
$driver = Kronolith::getDriver('Resource');
$existing_groups = $driver->getGroupMemberships($this->_resource->getId());
$new_groups = $this->_vars->get('category');
$new_groups = is_null($new_groups) ? array() : $new_groups;
foreach ($existing_groups as $gid) {
$i = array_search($gid, $new_groups);
if ($i === false) {
// No longer in this group
$group = $driver->getResource($gid);
$members = $group->get('members');
$idx = array_search($this->_resource->getId(), $members);
if ($idx !== false) {
unset($members[$idx]);
reset($members);
$group->set('members', $members);
$group->save();
}
} else {
// We know it's already in the group, remove it so we don't
// have to check/add it again later.
unset($new_groups[$i]);
}
}
reset($new_groups);
foreach ($new_groups as $gid) {
$group = $driver->getResource($gid);
$members = $group->get('members');
$members[] = $this->_resource->getId();
$group->set('members', $members);
$group->save();
}
try {
$this->_resource->save();
} catch (Exception $e) {
throw new Kronolith_Exception(sprintf(_("Unable to save resource \"%s\": %s"), $new_name, $e->getMessage()));
}
return $this->_resource;
case _("Delete"):
Horde::url('resources/delete.php')->add('c', $this->_vars->c)->redirect();
break;
case _("Cancel"):
Horde::url($GLOBALS['prefs']->getValue('defaultview') . '.php', true)->redirect();
break;
}
}
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:58,代码来源:EditResource.php
示例12: _handleAutoCompleter
/**
*/
protected function _handleAutoCompleter($input)
{
$ret = array();
// For now, return all resources.
$resources = Kronolith::getDriver('Resource')->listResources(Horde_Perms::READ, array(), 'name');
foreach ($resources as $r) {
if (strpos(Horde_String::lower($r->get('name')), Horde_String::lower($input)) !== false) {
$ret[] = array('name' => $r->get('name'), 'code' => $r->getId());
}
}
return $ret;
}
开发者ID:jubinpatel,项目名称:horde,代码行数:14,代码来源:ResourceAutoCompleter.php
示例13: __construct
/**
* @throws Kronolith_Exception
*/
public function __construct($vars)
{
parent::__construct($vars, _("Create Resource Group"));
$resources = Kronolith::getDriver('Resource')->listResources(Horde_Perms::READ, array('isgroup' => 0));
$enum = array();
foreach ($resources as $resource) {
$enum[$resource->getId()] = htmlspecialchars($resource->get('name'));
}
$this->addVariable(_("Name"), 'name', 'text', true);
$this->addVariable(_("Description"), 'description', 'longtext', false, false, null, array(4, 60));
$this->addVariable(_("Resources"), 'members', 'multienum', false, false, null, array('enum' => $enum));
$this->setButtons(array(_("Create")));
}
开发者ID:raz0rsdge,项目名称:horde,代码行数:16,代码来源:CreateResourceGroup.php
示例14: initialize
/**
* Attempts to open a connection to the SQL server.
*
* @throws Kronolith_Exception
*/
public function initialize()
{
if (empty($this->_params['db'])) {
throw new InvalidArgumentException('Missing required Horde_Db_Adapter instance');
}
try {
$this->_db = $this->_params['db'];
} catch (Horde_Exception $e) {
throw new Kronolith_Exception($e);
}
$this->_params = array_merge(array('table' => 'kronolith_resources'), $this->_params);
$this->_driver = Kronolith::getDriver();
$this->_columns = $this->_db->columns($this->_params['table']);
}
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:19,代码来源:Sql.php
示例15: html
public function html($active = true)
{
if (!$this->_event) {
echo '<h3>' . _("Event not found") . '</h3>';
exit;
}
if (is_string($this->_event)) {
echo '<h3>' . $this->_event . '</h3>';
exit;
}
global $conf, $prefs;
$this->_event->loadHistory();
$creatorId = $this->_event->creator;
$description = $this->_event->description;
$location = $this->_event->location;
$eventurl = $this->_event->url;
$private = $this->_event->isPrivate();
$owner = Kronolith::getUserName($creatorId);
$status = Kronolith::statusToString($this->_event->status);
$attendees = $this->_event->attendees;
$resources = $this->_event->getResources();
if ($datetime = Horde_Util::getFormData('datetime')) {
$datetime = new Horde_Date($datetime);
$month = $datetime->month;
$year = $datetime->year;
} else {
$month = (int) Horde_Util::getFormData('month', date('n'));
$year = (int) Horde_Util::getFormData('year', date('Y'));
}
$dateFormat = $prefs->getValue('date_format');
$timeFormat = $prefs->getValue('twentyFour') ? 'G:i' : 'g:ia';
// Tags
$tags = implode(', ', $this->_event->tags);
echo '<div id="Event"' . ($active ? '' : ' style="display:none"') . '>';
require KRONOLITH_TEMPLATES . '/view/view.inc';
echo '</div>';
if ($active && $GLOBALS['browser']->hasFeature('dom')) {
/* We check for read permissions, because we can always save a
* copy if we can read the event. */
if ($this->_event->hasPermission(Horde_Perms::READ) && Kronolith::getDefaultCalendar(Horde_Perms::EDIT)) {
$edit = new Kronolith_View_EditEvent($this->_event);
$edit->html(false);
}
if ($this->_event->hasPermission(Horde_Perms::DELETE)) {
$delete = new Kronolith_View_DeleteEvent($this->_event);
$delete->html(false);
}
}
}
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:49,代码来源:Event.php
示例16: __construct
/**
*
* @param Horde_Date $date
*
* @return Kronolith_View_Year
*/
public function __construct(Horde_Date $date)
{
$this->year = $date->year;
$startDate = new Horde_Date(array('year' => $this->year, 'month' => 1, 'mday' => 1));
$endDate = new Horde_Date(array('year' => $this->year, 'month' => 12, 'mday' => 31));
try {
$this->_events = Kronolith::listEvents($startDate, $endDate, $GLOBALS['calendar_manager']->get(Kronolith::DISPLAY_CALENDARS));
} catch (Exception $e) {
$GLOBALS['notification']->push($e, 'horde.error');
$this->_events = array();
}
if (!is_array($this->_events)) {
$this->_events = array();
}
}
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:21,代码来源:Year.php
示例17: __construct
/**
* @throws Kronolith_Exception
*/
public function __construct($vars, $resource)
{
$this->_resource = $resource;
parent::__construct($vars, sprintf(_("Edit %s"), $resource->get('name')));
$resources = Kronolith::getDriver('Resource')->listResources(Horde_Perms::READ, array('isgroup' => 0));
$enum = array();
foreach ($resources as $r) {
$enum[$r->getId()] = htmlspecialchars($r->get('name'));
}
$this->addHidden('', 'c', 'text', true);
$this->addVariable(_("Name"), 'name', 'text', true);
$this->addVariable(_("Description"), 'description', 'longtext', false, false, null, array(4, 60));
$this->addVariable(_("Resources"), 'members', 'multienum', false, false, null, array('enum' => $enum));
$this->setButtons(array(_("Save"), array('class' => 'horde-delete', 'value' => _("Delete")), array('class' => 'horde-cancel', 'value' => _("Cancel"))));
}
开发者ID:raz0rsdge,项目名称:horde,代码行数:18,代码来源:EditResourceGroup.php
示例18: execute
/**
* @throws Kronolith_Exception
*/
public function execute()
{
if ($this->_vars->get('submitbutton') == _("Cancel")) {
Horde::url($GLOBALS['prefs']->getValue('defaultview') . '.php', true)->redirect();
}
if (!$this->_resource->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::DELETE)) {
throw new Kronolith_Exception(_("Permission denied"));
}
// Delete the resource.
try {
Kronolith::getDriver('Resource')->delete($this->_resource);
} catch (Exception $e) {
throw new Kronolith_Exception(sprintf(_("Unable to delete \"%s\": %s"), $this->_resource->get('name'), $e->getMessage()));
}
}
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:18,代码来源:DeleteResourceGroup.php
示例19: execute
/**
* @throws Kronolith_Exception
*/
public function execute()
{
$new = array('name' => $this->_vars->get('name'), 'description' => $this->_vars->get('description'), 'response_type' => $this->_vars->get('responsetype'), 'email' => $this->_vars->get('email'));
$resource = Kronolith_Resource::addResource(new Kronolith_Resource_Single($new));
/* Do we need to add this to any groups? */
$groups = $this->_vars->get('category');
if (!empty($groups)) {
foreach ($groups as $group_id) {
$group = Kronolith::getDriver('Resource')->getResource($group_id);
$members = $group->get('members');
$members[] = $resource->getId();
$group->set('members', $members);
$group->save();
}
}
}
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:19,代码来源:CreateResource.php
示例20: execute
/**
* @throws Kronolith_Exception
*/
public function execute()
{
switch ($this->_vars->submitbutton) {
case _("Save"):
$info = array();
foreach (array('name', 'new_url', 'user', 'password', 'color', 'desc') as $key) {
$info[$key == 'new_url' ? 'url' : $key] = $this->_vars->get($key);
}
Kronolith::subscribeRemoteCalendar($info, trim($this->_vars->get('url')));
break;
case _("Unsubscribe"):
Horde::url('calendars/remote_unsubscribe.php')->add('url', $this->_vars->url)->redirect();
break;
case _("Cancel"):
Horde::url($GLOBALS['prefs']->getValue('defaultview') . '.php', true)->redirect();
break;
}
}
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:21,代码来源:EditRemoteCalendar.php
注:本文中的Kronolith类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论