예제 #1
0
 function form($object)
 {
     global $db;
     $tag_collections = $db->selectObjects("tag_collections");
     foreach ($tag_collections as $tag_collections => $collection) {
         $tc_list[$collection->id] = $collection->name;
     }
     //eDebug($all_calendars);
     $form = new form();
     if (!isset($object->id)) {
         // $object->enable_categories = 0;
         $object->enable_feedback = 0;
         $object->reminder_notify = serialize(array());
         $object->email_title_reminder = "Calendar Reminder";
         $object->email_from_reminder = "Calendar Manager";
         $object->email_address_reminder = "calendar@" . HOSTNAME;
         $object->email_reply_reminder = "calendar@" . HOSTNAME;
         $object->email_showdetail = 0;
         $object->email_signature = "--\nThanks, Webmaster";
         $object->aggregate = array();
         $object->enable_rss = false;
         $object->enable_ical = true;
         $object->feed_title = "";
         $object->feed_desc = "";
         $object->rss_limit = 365;
         $object->rss_cachetime = 60;
         // $object->enable_tags = false;
         // $object->collections = array();
         // $object->group_by_tags = false;
         // $object->show_tags = array();
     } else {
         $form->meta('id', $object->id);
         // $cols = unserialize($object->collections);
         // $object->collections = array();
         // $available_tags = array();
         // if (!empty($cols)) {
         // foreach ($cols as $col_id) {
         // $collection = $db->selectObject('tag_collections', 'id='.$col_id);
         // $object->collections[$collection->id] = $collection->name;
         // //while we're here we will get the list of available tags.
         // $tmp_tags = $db->selectObjects('tags', 'collection_id='.$col_id);
         // foreach ($tmp_tags as $tag) {
         // $available_tags[$tag->id] = $tag->name;
         // }
         // }
         // }
         // //Get the tags the user chose to show in the group by views
         // $stags = unserialize($object->show_tags);
         // $object->show_tags = array();
         // //			if (is_array($stags)) {
         // if (!empty($stags)) {
         // foreach ($stags as $stag_id) {
         // $show_tag = $db->selectObject('tags', 'id='.$stag_id);
         // $object->show_tags[$show_tag->id] = $show_tag->name;
         // }
         // }
     }
     // setup the listbuilder arrays for calendar aggregation.
     $loc = unserialize($object->location_data);
     $calendars = expModules::listInstalledControllers('calendarmodule');
     $saved_aggregates = empty($object->aggregate) ? array() : unserialize($object->aggregate);
     $all_calendars = array();
     $selected_calendars = array();
     foreach ($calendars as $src => $cal) {
         $calendar_name = (empty($cal->title) ? 'Untitled' : $cal->title) . ' on page ' . $cal->section;
         if ($src != $loc->src) {
             if (in_array($src, $saved_aggregates)) {
                 $selected_calendars[$src] = $calendar_name;
             } else {
                 $all_calendars[$src] = $calendar_name;
             }
         }
     }
     // setup the config form
     $form->register(null, '', new htmlcontrol('<h3>' . gt('General Configuration') . '</h3><hr size="1" />'));
     // $form->register('enable_categories',gt('Enable Categories'),new checkboxcontrol($object->enable_categories,true));
     $form->register('enable_feedback', gt('Enable Feedback'), new checkboxcontrol($object->enable_feedback, true));
     $form->register(null, '', new htmlcontrol('<h3>' . gt('Events Reminder Email') . '</h3><hr size="1" />'));
     // Get original style user lists
     // $selected_users = array();
     // foreach(unserialize($object->reminder_notify) as $i) {
     // $selected_users[$i] = $db->selectValue('user', 'firstname', 'id='.$i) . ' ' . $db->selectValue('user', 'lastname', 'id='.$i) . ' (' . $db->selectValue('user', 'username', 'id='.$i) . ')';
     // }
     // $userlist = array();
     // $list = user::getAllUsers();
     // foreach ($list as $i) {
     // if(!array_key_exists($i->id, $selected_users)) {
     // $userlist[$i->id] = $i->firstname . ' ' . $i->lastname . ' (' . $i->username . ')';
     // }
     // }
     // $form->register('reminder_notify',gt('Who should be reminded of events?'),new listbuildercontrol($selected_users, $userlist));
     // Get User list
     $defaults = array();
     $userlist = array();
     $users = user::getAllUsers();
     foreach ($db->selectObjects('calendar_reminder_address', 'calendar_id=' . $object->id . ' and user_id != 0') as $address) {
         $locuser = user::getUserById($address->user_id);
         $defaults[$locuser->id] = $locuser->firstname . ' ' . $locuser->lastname . ' (' . $locuser->username . ')';
     }
     foreach ($users as $locuser) {
         if (!array_key_exists($locuser->id, $defaults)) {
             $userlist[$locuser->id] = $locuser->firstname . ' ' . $locuser->lastname . ' (' . $locuser->username . ')';
         }
     }
     $form->register('users', gt('Users'), new listbuildercontrol($defaults, $userlist));
     // Get Group list
     $defaults = array();
     $grouplist = array();
     $groups = group::getAllGroups();
     if ($groups != null) {
         foreach ($db->selectObjects('calendar_reminder_address', 'calendar_id=' . $object->id . ' and group_id != 0') as $address) {
             $group = group::getGroupById($address->group_id);
             $defaults[$group->id] = $group->name;
         }
         foreach ($groups as $group) {
             if (!array_key_exists($group->id, $defaults)) {
                 $grouplist[$group->id] = $group->name;
             }
         }
         $form->register('groups', gt('Groups'), new listbuildercontrol($defaults, $grouplist));
     }
     // Get Freeform list
     $defaults = array();
     foreach ($db->selectObjects('calendar_reminder_address', 'calendar_id=' . $object->id . " and email != ''") as $address) {
         $defaults[$address->email] = $address->email;
     }
     $form->register('addresses', gt('Other Addresses'), new listbuildercontrol($defaults, null));
     $form->register('email_title_reminder', gt('Message Subject Prefix'), new textcontrol($object->email_title_reminder, 45));
     $form->register('email_from_reminder', gt('From (Display)'), new textcontrol($object->email_from_reminder, 45));
     $form->register('email_address_reminder', gt('From (Email)'), new textcontrol($object->email_address_reminder, 45));
     $form->register('email_reply_reminder', gt('Reply-to'), new textcontrol($object->email_reply_reminder, 45));
     $form->register('email_showdetail', gt('Show detail in message?'), new checkboxcontrol($object->email_showdetail));
     $form->register('email_signature', gt('Email Signature'), new texteditorcontrol($object->email_signature, 5, 30));
     $form->register(null, '', new htmlcontrol('<h3>' . gt('Merge Calendars') . '</h3><hr size="1" />'));
     $form->register('aggregate', gt('Pull Events from These Other Calendars'), new listbuildercontrol($selected_calendars, $all_calendars));
     $form->register(null, '', new htmlcontrol('<h3>' . gt('RSS/iCalendar Configuration') . '</h3><hr size="1" />'));
     $form->register('enable_rss', gt('Enable RSS'), new checkboxcontrol($object->enable_rss));
     $form->register('enable_ical', gt('Enable iCalendar'), new checkboxcontrol($object->enable_ical));
     $form->register('feed_title', gt('Title for this RSS feed'), new textcontrol($object->feed_title, 35, false, 75));
     $form->register('feed_desc', gt('Description for this RSS feed'), new texteditorcontrol($object->feed_desc));
     $form->register('rss_cachetime', gt('Recommended RSS/iCal feed update interval in minutes (1440 = 1 day)'), new textcontrol($object->rss_cachetime));
     $form->register('rss_limit', gt('Maximum days of RSS/iCal items to publish (0 = all)'), new textcontrol($object->rss_limit));
     // $form->register(null,'',new htmlcontrol('<h3>'.gt('Tagging').'</h3><hr size="1" />'));
     // $form->register('enable_tags',gt('Enable Tags'), new checkboxcontrol($object->enable_tags));
     // $form->register('collections',gt('Tag Collections'),new listbuildercontrol($object->collections,$tc_list));
     // $form->register('group_by_tags',gt('Filter events by tags'), new checkboxcontrol($object->group_by_tags));
     // $form->register(null,'',new htmlcontrol(gt('Tags to show')));
     // $form->register('show_tags','',new listbuildercontrol($object->show_tags,$available_tags));
     $form->register('submit', '', new buttongroupcontrol(gt('Save'), '', gt('Cancel')));
     return $form;
 }
 function configure()
 {
     expHistory::set('editable', $this->params);
     // little bit of trickery so that that categories can have their own configs
     $this->loc->src = "@store-" . $this->params['id'];
     $config = new expConfig($this->loc);
     $this->config = $config->config;
     $pullable_modules = expModules::listInstalledControllers($this->classname, $this->loc);
     $views = get_config_templates($this, $this->loc);
     assign_to_template(array('config' => $this->config, 'pullable_modules' => $pullable_modules, 'views' => $views));
 }
예제 #3
0
 /**
  * generic config action
  */
 function configure()
 {
     expHistory::set('editable', $this->params);
     $pullable_modules = expModules::listInstalledControllers($this->classname, $this->loc);
     $views = get_config_templates($this, $this->loc);
     $page = new expPaginator(array('records' => $pullable_modules, 'limit' => count($pullable_modules), 'order' => 'section', 'columns' => array('Title' => 'title', 'Page' => 'section')));
     assign_to_template(array('config' => $this->config, 'pullable_modules' => $pullable_modules, 'page' => $page, 'views' => $views));
 }
예제 #4
0
 function configure()
 {
     expHistory::set('editable', $this->params);
     // little bit of trickery so that that categories can have their own configs
     $this->loc->src = "@globalstoresettings";
     $config = new expConfig($this->loc);
     $this->config = $config->config;
     $pullable_modules = expModules::listInstalledControllers($this->classname, $this->loc);
     $views = get_config_templates($this, $this->loc);
     $gc = new geoCountry();
     $countries = $gc->find('all');
     $gr = new geoRegion();
     $regions = $gr->find('all');
     assign_to_template(array('config' => $this->config, 'pullable_modules' => $pullable_modules, 'views' => $views, 'countries' => $countries, 'regions' => $regions));
 }