/** * Gets the events for the given month +-2 weeks * @return array The array contains event */ function getEvents($year_month = null, $user_id = null, $attendants = false) { $db = JFactory::getDBO(); if (!$user_id) { $user = JFactory::getUser(); } else { $user = JUser::getInstance(intval($user_id)); } if ($year_month == null) { $year_month = date("Y-m-") . "01"; } if ($year_month == 'all') { $query = "SELECT raid_id,location,description,icon_name,status,raid_leader,start_time,(DATE_ADD(start_time,INTERVAL duration_mins MINUTE)) AS end_time\n\t \t\t\t\tFROM #__raidplanner_raid\n\t \t\t\t\tGROUP BY raid_id\n\t \t\t\t\tORDER BY start_time ASC, location ASC"; } else { if ($year_month == 'own') { $query = "SELECT r.raid_id,r.location,r.description,r.icon_name,r.status,r.raid_leader,r.start_time,(DATE_ADD(r.start_time,INTERVAL r.duration_mins MINUTE)) AS end_time,r.description,r.invite_time\n\t \t\t\t\tFROM #__raidplanner_signups AS s\n\t \t\t\t\tLEFT JOIN #__raidplanner_raid AS r ON r.raid_id=s.raid_id\n\t \t\t\t\tLEFT JOIN #__raidplanner_character AS c ON c.character_id=s.character_id\n\t \t\t\t\tWHERE c.profile_id = " . $user->id . "\n\t \t\t\t\tGROUP BY r.raid_id\n\t \t\t\t\tORDER BY r.start_time ASC, r.location ASC"; } else { $query = "SELECT r.raid_id,r.location,r.description,r.icon_name,r.status,r.raid_leader,r.start_time,(DATE_ADD(r.start_time,INTERVAL r.duration_mins MINUTE)) AS end_time,s.queue\n\t \t\t\t\tFROM #__raidplanner_raid AS r\n\t \t\t\t\tLEFT JOIN (#__raidplanner_signups AS s, #__raidplanner_character AS c) ON (s.raid_id=r.raid_id AND c.character_id=s.character_id AND c.profile_id=" . $user->id . ") \n\t \t\t\t\tWHERE r.start_time>=DATE_SUB(" . $db->Quote($year_month) . ",interval 2 week) AND r.start_time<=DATE_ADD(" . $db->Quote($year_month) . ",interval 7 week)\n\t \t\t\t\tGROUP BY r.raid_id\n\t \t\t\t\tORDER BY r.start_time ASC, r.location ASC"; } } $db->setQuery($query); $rows = $db->loadObjectList(); $result = array(); foreach ($rows as $row) { $date = JHTML::_('date', $row->start_time, RaidPlannerHelper::sqlDateFormat()); /* get the attendants if requested */ if ($attendants) { $query = "SELECT c.char_name\n\t\t\t\t\t\tFROM #__raidplanner_signups AS s\n\t\t\t\t\t\tLEFT JOIN #__raidplanner_character AS c ON c.character_id=s.character_id\n\t\t\t\t\t\tWHERE s.raid_id=" . intval($row->raid_id) . " AND s.queue=1\n\t\t\t\t\t\tORDER BY s.confirmed DESC, c.char_name ASC"; $db->setQuery($query); $row->attendants = $db->loadColumn(); } $result[$date][] = $row; } return $result; }
function display($tpl = null) { //get the guild $guild = $this->get('Data'); $isNew = $guild->guild_id < 1; $text = $isNew ? JText::_('JTOOLBAR_NEW') : JText::_('JTOOLBAR_EDIT'); JToolBarHelper::title(JText::_('COM_RAIDPLANNER_GUILD') . ': ' . $text . ''); JToolBarHelper::apply(); JToolBarHelper::save(); if ($isNew) { JToolBarHelper::cancel(); } else { // for existing items the button is renamed `close` JToolBarHelper::cancel('cancel', 'JTOOLBAR_CLOSE'); } $model = $this->getModel(); $plugins = RaidPlannerHelper::getSyncPlugins(); $plugin_params = array(); if ($guild->sync_plugin != '' && ($plugin = RaidPlannerHelper::getGuildPlugin($guild->guild_id))) { $plugin_params = RaidPlannerHelper::getSyncPluginParams($guild->sync_plugin); $this->assign('do_sync', $plugin->trigger('onRPBeforeSync')); /* FIXME, don't know if this plugin provide sync abilities */ } else { $this->assign('do_sync', false); } $this->assignRef('sync_plugins', $plugins); $this->assignRef('sync_params', $plugin_params); $this->assignRef('guild', $guild); parent::display($tpl); }
function display($tpl = null) { /* Load required javascripts */ RaidPlannerHelper::loadJSFramework(true); JHTML::script('com_raidplanner/HtmlTable.Extended.js', false, true); $model = $this->getModel(); $paramsObj = JComponentHelper::getParams('com_raidplanner'); $menuitemid = JRequest::getInt('Itemid'); if ($menuitemid) { $menu = JFactory::getApplication()->getMenu(); $menuparams = $menu->getParams($menuitemid); $paramsObj->merge($menuparams); } $guild_id = $paramsObj->get('guild_id', '0'); $show_account = $paramsObj->get('show_account', '0'); $initial_sort = $paramsObj->get('initial_sort', '0'); $guild_plugin = RaidPlannerHelper::getGuildPlugin($guild_id); if ($guild_plugin != null) { $sync_interval = $paramsObj->get('sync_interval', 4); $sync_enabled = $paramsObj->get('armory_sync', '0') == 1; if ($sync_enabled) { $guild_plugin->trigger('onRPSyncGuild', array($guild_id, $sync_interval, false)); } $guild_plugin->trigger('onRPLoadCSS'); } $this->assignRef('guild_plugin', $guild_plugin); $this->assign('characters', $model->getGuildCharacters($guild_id)); $this->assign('guildinfo', $model->getGuildInfo($guild_id)); $this->assign('ranks', RaidPlannerHelper::getRanks()); $this->assignRef('show_account', $show_account); $this->assignRef('initial_sort', $initial_sort); parent::display($tpl); }
/** * display method of Stats view * @return void **/ function display($tpl = null) { /* Load Javascript and CSS files */ RaidPlannerHelper::loadJSFramework(); /* Get state, and params */ $app = JFactory::getApplication(); $params = $app->getParams(); $state = $this->get('state'); $guild_id = $params->get('guild_id', '0'); $groups = $params->get('allowed_groups'); $by_chars = $params->get('stats_by_chars', 0); $show_rating = $params->get('show_rating', 0); /* Get the values from the state object that were inserted in the model's construct function */ $lists['filter_start_time'] = $state->get('filter_start_time'); $lists['filter_end_time'] = $state->get('filter_end_time'); $lists['filter_character_id'] = $state->get('filter_character_id'); $lists['filter_group_id'] = $state->get('filter_group_id'); $this->assign('guilds', RaidPlannerHelper::getGuilds()); $this->assign('groups', RaidPlannerHelper::getGroups(true, $groups)); $this->assign('characters', RaidPlannerHelper::getCharacters()); $this->assignRef('lists', $lists); $this->assignRef('by_chars', $by_chars); $this->assignRef('show_rating', $show_rating); $this->assignRef('guild_id', $guild_id); parent::display($tpl); }
/** * Method to store a record * * @access public * @return boolean True on success */ function store() { $row = $this->getTable(); $data = JRequest::get('post'); if ($data['minimum_level'] == '') { $data['minimum_level'] = NULL; } if ($data['maximum_level'] == '') { $data['maximum_level'] = NULL; } if ($data['minimum_rank'] == '') { $data['minimum_rank'] = NULL; } // convert datetimes to UTC $data['start_time'] = RaidPlannerHelper::getDate($data['start_time'], null, 'sql'); $data['invite_time'] = RaidPlannerHelper::getDate($data['invite_time'], null, 'sql'); // Bind the form fields to the table if (!$row->bind($data)) { $this->setError($this->_db->getErrorMsg()); return false; } // Make sure the record is valid if (!$row->check()) { $this->setError($this->_db->getErrorMsg()); return false; } // Store the raid table to the database if (!$row->store(true)) { $this->setError($this->_db->getErrorMsg()); return false; } return $row->raid_id; }
function display($tpl = null) { JToolBarHelper::title(JText::_('COM_RAIDPLANNER_RAIDS'), 'generic.png'); JToolBarHelper::addNew(); JToolBarHelper::editList(); JToolBarHelper::deleteList(); RaidPlannerHelper::showToolbarButtons(); // Get data from the model $raids = $this->get('Data'); $pagination = $this->get('Pagination'); $this->assign('guilds', RaidPlannerHelper::getGuilds()); $this->assignRef('raids', $raids); $this->assignRef('pagination', $pagination); /* Call the state object */ $state = $this->get('state'); /* Get the values from the state object that were inserted in the model's construct function */ $lists['search'] = $state->get('filter_raid_search'); $lists['guild_filter'] = $state->get('filter_guild_filter'); $lists['start_time_min'] = $state->get('filter_raid_start_time_min'); $lists['start_time_max'] = $state->get('filter_raid_start_time_max'); $lists['order_Dir'] = $state->get('filter_order_Dir'); $lists['order'] = $state->get('filter_order'); $this->assignRef('lists', $lists); parent::display($tpl); }
/** * Returns a list of post items */ public static function getItems($raidshowNumber, $user_id) { // get a reference to the database $db = JFactory::getDBO(); // get a list of $raidshow_number ordered by start_time $query = "SELECT r.raid_id,r.location,r.start_time,s.confirmed,c.char_name,ro.role_name\n\t\t\t\t\tFROM `#__raidplanner_raid` AS r\n\t\t\t\t\tLEFT JOIN (`#__raidplanner_signups` AS s,`#__raidplanner_character` AS c) ON (s.raid_id = r.raid_id AND c.character_id = s.character_id AND c.profile_id = " . intval($user_id) . ")\n\t\t\t\t\tLEFT JOIN `#__raidplanner_role` AS ro ON ro.role_id = s.role_id\n\t\t\t\t\tWHERE DATE(DATE_ADD(start_time, INTERVAL " . intval(RaidPlannerHelper::getTimezone()) . " HOUR))>=NOW()\n\t\t\t\t\tGROUP BY r.raid_id\n\t\t\t\t\tORDER BY start_time ASC, location ASC LIMIT " . intval($raidshowNumber); $db->setQuery($query); $items = ($items = $db->loadObjectList()) ? $items : array(); return $items; }
/** * Returns a list of post items */ public static function getItems($user_id, $days = 1) { // get a reference to the database $db = JFactory::getDBO(); // get a list of raids ordered by start_time $query = "SELECT r.raid_id,r.location,r.start_time,s.confirmed,c.char_name,ro.role_name,(p.user_id = " . intval($user_id) . ") AS invited,(s.raid_id = r.raid_id) AS signed\r\n\t\t\t\t\tFROM `#__raidplanner_raid` AS r\r\n\t\t\t\t\tLEFT JOIN `#__user_usergroup_map` AS p ON p.group_id = r.invited_group_id AND p.user_id = " . intval($user_id) . "\r\n\t\t\t\t\tLEFT JOIN (`#__raidplanner_signups` AS s,`#__raidplanner_character` AS c) ON (s.raid_id = r.raid_id AND c.character_id = s.character_id AND c.profile_id = " . intval($user_id) . ")\r\n\t\t\t\t\tLEFT JOIN `#__raidplanner_role` AS ro ON ro.role_id = s.role_id\r\n\t\t\t\t\tWHERE DATE(DATE_ADD(start_time, INTERVAL " . intval(RaidPlannerHelper::getTimezone()) . " HOUR))>=DATE(NOW()) AND DATE(DATE_ADD(start_time, INTERVAL " . intval(RaidPlannerHelper::getTimezone()) . " HOUR))<DATE_ADD(DATE(NOW()), INTERVAL " . $days . " DAY) GROUP BY r.raid_id ORDER BY start_time ASC, location ASC"; $db->setQuery($query); $items = ($items = $db->loadObjectList()) ? $items : array(); return $items; }
/** * display method of Hello view * @return void **/ function display($tpl = null) { //get the data JToolBarHelper::title(JText::_('COM_RAIDPLANNER')); JToolBarHelper::preferences('com_raidplanner'); RaidPlannerHelper::showToolbarButtons(); $plugins = $this->getPluginList(); $this->assignRef('installed_plugins', $plugins); parent::display($tpl); }
function display($tpl = null) { JToolBarHelper::title(JText::_('COM_RAIDPLANNER_ROLES'), 'generic.png'); JToolBarHelper::addNew(); JToolBarHelper::editList(); JToolBarHelper::deleteList(); RaidPlannerHelper::showToolbarButtons(); // Get data from the model $roles = $this->get('Data'); $this->assignRef('roles', $roles); parent::display($tpl); }
function display($tpl = null) { $model = $this->getModel(); $canEdit = $model->canEdit() == 1; $this->assignRef('character', $model->getCharacter(JRequest::getVar('character'), JRequest::getInt('char_id'))); $this->assignRef('characters', $model->getCharacters()); $this->assignRef('guilds', RaidPlannerHelper::getGuilds()); $this->assignRef('genders', RaidPlannerHelper::getGenders()); $this->assignRef('races', RaidPlannerHelper::getRaces()); $this->assignRef('classes', RaidPlannerHelper::getClasses()); $this->assignRef('canEdit', $canEdit); parent::display($tpl); }
function display($tpl = null) { $model = $this->getModel(); if (!$model->userIsOfficer(JRequest::getVar('id'))) { $app = JFactory::getApplication(); $app->redirect(JRoute::_('index.php?option=com_raidplanner&task=default&month=' . JRequest::getVar('month') . '&modalevent=' . JRequest::getVar('id'))); } else { $template_id = JRequest::getVar('template_id'); if (intval($template_id) > 0) { $event = $model->getEvent($template_id, true); } else { $event = $model->getEvent(JRequest::getVar('id')); } $this->assign('icons', $this->getIcons()); $this->assign('guilds', RaidPlannerHelper::getGuilds()); $this->assign('groups', RaidPlannerHelper::getGroups(false)); $this->assignRef('event', $event); $this->assign('templates', $model->getTemplates()); $this->assign('candelete', $model->canDelete($event->raid_id)); parent::display($tpl); /* display the event in detail */ $vName = 'event'; $mName = 'event'; $document = JFactory::getDocument(); $vType = $document->getType(); $vLayout = 'preview'; $controller = new RaidPlannerController(); $view = $controller->getView($vName, $vType); $view->addTemplatePath(JPATH_COMPONENT_ADMINISTRATOR . '/views/' . strtolower($vName) . '/tmpl'); // Get/Create the model if ($model = $this->getModel($mName)) { // Push the model into the view (as default) $view->setModel($model, true); } // add event model to calendar view if ($vName == 'calendar') { $eventmodel = $this->getModel('event'); $view->setModel($eventmodel, false); } // Set the layout $view->setLayout($vLayout); // Display the view $view->display(); } }
/** * Method to format the specified value for text type **/ public function getFieldData($field) { $value = $field['value']; if (empty($value)) { return $value; } $chars = RaidPlannerHelper::getProfileChars($value, true, true); $oReturn = ''; foreach ($chars as $char) { $oReturn .= '<span class="' . $char['class_css'] . ' ' . $char['race_css'] . '">' . $char['char_name'] . '<span>'; if ($char['guild_name'] != '') { $oReturn .= ' ‹' . $char['guild_name'] . '›'; } $oReturn .= "\n"; } $oReturn = str_replace("\n", "<br />", trim($oReturn)); return $oReturn; }
/** * display method of Stats view * @return void **/ function display($tpl = null) { /* Load Javascript and CSS files */ RaidPlannerHelper::loadJSFramework(); JHTML::stylesheet('com_raidplanner/raidplanner_admin.css', false, true, false); //get the data JToolBarHelper::title(JText::_('COM_RAIDPLANNER_STATS')); RaidPlannerHelper::showToolbarButtons(); /* Call the state object */ $state = $this->get('state'); /* Get the values from the state object that were inserted in the model's construct function */ $lists['filter_start_time'] = $state->get('filter_start_time'); $lists['filter_end_time'] = $state->get('filter_end_time'); $lists['filter_character_id'] = $state->get('filter_character_id'); $lists['filter_group_id'] = $state->get('filter_group_id'); $this->assign('guilds', RaidPlannerHelper::getGuilds()); $this->assign('groups', RaidPlannerHelper::getGroups()); $this->assign('characters', RaidPlannerHelper::getCharacters()); $this->assignRef('lists', $lists); parent::display($tpl); }
function display($tpl = null) { $user = JFactory::getUser(); if ($user->id == 0) { // user not logged in $user = JUser::getInstance(intval(@$_REQUEST['user'])); if ($user->getParam('calendar_secret', '') != '' && $user->getParam('calendar_secret', '') == $_REQUEST['secret']) { // access validated } else { die('Invalid access!'); } } $canView = RaidPlannerHelper::getPermission('view_raids') == 1; $model = $this->getModel(); $this->assignRef('canView', $canView); $this->assignRef('events', $model->getEvents('own', $user->id)); header("Content-Type: text/Calendar"); header("Content-Disposition: inline; filename=raid_calendar.ics"); parent::display($tpl); $app = JFactory::getApplication(); $app->close(); }
/** * display method of Hello view * @return void **/ function display($tpl = null) { //get the raid $raid = $this->get('Data'); $isNew = $raid->raid_id < 1; $text = $isNew ? JText::_('JTOOLBAR_NEW') : JText::_('JTOOLBAR_EDIT'); JToolBarHelper::title(JText::_('COM_RAIDPLANNER_RAID') . ': ' . $text . ''); JToolBarHelper::apply(); JToolBarHelper::save(); if ($isNew) { JToolBarHelper::cancel(); } else { // for existing items the button is renamed `close` JToolBarHelper::cancel('cancel', 'JTOOLBAR_CLOSE'); } $this->assignRef('users', RaidPlannerHelper::getUsers()); $this->assignRef('guilds', RaidPlannerHelper::getGuilds()); $this->assignRef('groups', RaidPlannerHelper::getGroups()); $this->assignRef('icons', $this->getIcons()); $this->assignRef('raid', $raid); parent::display($tpl); }
function display($tpl = null) { //get the character $char = $this->get('Data'); $isNew = $char->character_id < 1; $text = $isNew ? JText::_('JTOOLBAR_NEW') : JText::_('JTOOLBAR_EDIT'); JToolBarHelper::title(JText::_('COM_RAIDPLANNER_CHARACTER') . ': ' . $text . ''); JToolBarHelper::apply(); JToolBarHelper::save(); if ($isNew) { JToolBarHelper::cancel(); } else { // for existing items the button is renamed `close` JToolBarHelper::cancel('cancel', 'JTOOLBAR_CLOSE'); } $model = $this->getModel(); $this->assign('users', RaidPlannerHelper::getUsers()); $this->assignRef('character', $char); $this->assign('classes', RaidPlannerHelper::getClasses()); $this->assign('genders', RaidPlannerHelper::getGenders()); $this->assign('races', RaidPlannerHelper::getRaces()); $this->assign('guilds', RaidPlannerHelper::getGuilds()); parent::display($tpl); }
/** * Method to display the view * * @access public */ public function display($cachable = false, $urlparams = array()) { $document = JFactory::getDocument(); $vType = $document->getType(); $mName = ''; // Get Itemid $menuItemid = JFactory::getApplication()->getMenu()->getActive()->id; $menuItemid = JRequest::getInt('Itemid', $menuItemid); switch ($this->getTask()) { case 'edit': $vName = 'edit'; $mName = 'event'; $vLayout = JRequest::getCmd('layout', 'default'); break; case 'signup': $vName = 'calendar'; $vLayout = JRequest::getCmd('layout', 'default'); $model = $this->getModel('event'); $model->signupEvent(); $month = $model->getMonth(); $this->setRedirect(JRoute::_('index.php?option=com_raidplanner&view=calendar&Itemid=' . $menuItemid . '&month=' . $month . '&modalevent=' . JRequest::getVar('raid_id'), false)); break; case 'rate': $vName = 'calendar'; $vLayout = JRequest::getCmd('layout', 'default'); $model = $this->getModel('event'); $model->rateEvent(); $month = $model->getMonth(); $this->setRedirect(JRoute::_('index.php?option=com_raidplanner&view=calendar&Itemid=' . $menuItemid . '&month=' . $month . '&modalevent=' . JRequest::getVar('raid_id'), false)); break; case 'saveevent': $template_id = JRequest::getVar('template_id'); if (intval($template_id) > 0) { $vName = 'edit'; $mName = 'event'; $vLayout = JRequest::getCmd('layout', 'default'); } else { $vName = 'calendar'; $vLayout = JRequest::getCmd('layout', 'default'); $model = $this->getModel('event'); $raid_id = $model->saveEvent(); $month = $model->getMonth(); $this->setRedirect(JRoute::_('index.php?option=com_raidplanner&view=calendar&Itemid=' . $menuItemid . '&month=' . $month . '&modalevent=' . $raid_id, false)); } break; case 'deleteevent': $vName = 'calendar'; $vLayout = JRequest::getCmd('layout', 'default'); $model = $this->getModel('event'); $month = $model->getMonth(); $model->deleteEvent(); $this->setRedirect(JRoute::_('index.php?option=com_raidplanner&view=calendar&Itemid=' . $menuItemid . '&month=' . $month, false)); break; case 'confirm': $vName = 'calendar'; $vLayout = JRequest::getCmd('layout', 'default'); $model = $this->getModel('event'); $model->confirmEvent(); $month = $model->getMonth(); $this->setRedirect(JRoute::_('index.php?option=com_raidplanner&view=calendar&Itemid=' . $menuItemid . '&month=' . $month . '&modalevent=' . JRequest::getVar('raid_id'), false)); break; case 'viewevent': $vName = 'event'; $mName = 'event'; $vLayout = JRequest::getCmd('layout', 'default'); break; case 'feed': $vName = 'calendar'; $vType = 'feed'; $vLayout = JRequest::getCmd('layout', 'feed'); break; case 'savecharacter': $vName = 'character'; $mName = 'character'; $model = $this->getModel('character'); JRequest::setVar('character_id', $model->saveCharacter()); $vLayout = JRequest::getCmd('layout', 'default'); break; case 'getjson': $vName = 'stats'; $vType = 'json'; $mName = 'stats'; $vLayout = JRequest::getCmd('layout', 'default'); break; default: case 'default': switch (JRequest::getVar('view')) { case 'roster': $vName = 'roster'; $mName = 'roster'; break; case 'character': $vName = 'character'; $mName = 'character'; break; case 'stats': $vName = 'stats'; $mName = 'stats'; break; default: $vName = 'calendar'; } $vLayout = JRequest::getCmd('layout', 'default'); break; } // Get/Create the view $view = $this->getView($vName, $vType); // Get/Create the model if ($model = $this->getModel($mName)) { // Push the model into the view (as default) $view->setModel($model, true); } // add event model to calendar view if ($vName == 'calendar') { /* Auto repeat raids if needed */ RaidPlannerHelper::autoRepeatRaids(); $eventmodel = $this->getModel('event'); $view->setModel($eventmodel, false); } // Set the layout $view->setLayout($vLayout); // Display the view $view->display(); }
<?php /*------------------------------------------------------------------------ # Class Form Template for RaidPlanner Component # com_raidplanner - RaidPlanner Component # ------------------------------------------------------------------------ # author Taracque # copyright Copyright (C) 2011 Taracque. All Rights Reserved. # @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL # Website: http://www.taracque.hu/raidplanner -------------------------------------------------------------------------*/ // no direct access defined('_JEXEC') or die('Restricted access'); if (RaidPlannerHelper::getJVersion() < '3.0') { RaidPlannerHelper::fixBootstrap(); } ?> <form action="index.php" method="post" name="adminForm" id="adminForm" class="form-horizontal"> <fieldset class="adminform"> <legend><?php echo JText::_('JDETAILS'); ?> </legend> <div class="control-group"> <label class="control-label" for="class_name"><?php echo JText::_('COM_RAIDPLANNER_CLASS_NAME'); ?> </label> <div class="controls"> <input class="text_area" type="text" name="class_name" id="class_name" size="32" maxlength="250" value="<?php echo $this->class->class_name;
<input type="text" name="maximum_level" id="maximum_level" value="<?php echo @$this->event->maximum_level; ?> " size="3" class="input-mini" /> </div> </div> <div class="control-group"> <label class="control-label" for="minimum_rank"><?php echo JText::_('COM_RAIDPLANNER_MINIMUM_RANK'); ?> : </label> <div class="controls"> <select name="minimum_rank" id=minimum_rank> <option value=""></option> <?php foreach (RaidPlannerHelper::getRanks() as $rank_id => $rank) { ?> <option value="<?php echo $rank_id; ?> "<?php if (@$this->event->minimum_rank === (string) $rank_id) { echo " selected=\"selected\""; } ?> ><?php echo $rank; ?> </option> <?php }
?> <img src="<?php echo JURI::base() . "media/com_raidplanner/raid_icons/" . $event->icon_name; ?> " alt="<?php echo $event->location; ?> " style="float:left; margin:2px; height: 2.5em;" /> <?php } ?> <?php if ($this->params['show_tooltips'] == 1) { ?> <?php echo RaidPlannerHelper::raidTooltip($event->raid_id); ?> <?php } else { ?> <?php echo JHTML::_('date', $event->start_time, $this->timeformat); ?> </strong> <?php echo $event->location; ?> <?php } ?> <?php } else {
function display($tpl = null) { $model = $this->getModel(); $paramsObj = JComponentHelper::getParams('com_raidplanner'); $menuitemid = JRequest::getInt('Itemid'); if ($menuitemid) { $menu = JFactory::getApplication()->getMenu(); $menuparams = $menu->getParams($menuitemid); $paramsObj->merge($menuparams); } $params = array('show_history' => $paramsObj->get('show_history', 0), 'macro_format' => $paramsObj->get('macro_format', ''), 'allow_rating' => $paramsObj->get('allow_rating', 0), 'multi_raid_signup' => $paramsObj->get('multi_raid_signup', 0)); if (RaidPlannerHelper::getPermission('view_raids') != 1) { $mainframe = JFactory::getApplication(); $mainframe->redirect(JRoute::_('index.php?option=com_raidplanner&view=default')); } else { $macro = false; $raid_id = JRequest::getInt('id'); $attendants = $model->getAttendants($raid_id); $event = $model->getEvent($raid_id); $characters = $model->getCharacters(@$event->minimum_level, @$event->maximum_level, @$event->minimum_rank, @$event->guild_id); $isOfficer = $model->userIsOfficer($event->raid_id); if ($isOfficer) { $all_characters = $model->getCharacters(@$event->minimum_level, @$event->maximum_level, @$event->minimum_rank, @$event->guild_id, true); foreach ($attendants as $att_key => $att_char) { // remove that from all_characters foreach ($all_characters as $all_key => $all_char) { if ($att_char->character_id == $all_char->character_id) { unset($all_characters[$all_key]); break; } } } if ($params['macro_format'] != '') { $macro = ''; foreach ($attendants as $attendant) { if ($attendant->confirmed == 1) { $macro .= str_replace('%c', $attendant->char_name, $params['macro_format']) . "\n"; } } } } else { $all_characters = array(); } RaidPlannerHelper::loadGuildCSS(@$event->guild_id); if ($params['multi_raid_signup'] == 1) { $upcoming = $model->getUpcomingEvents($event->start_time); $this->assignRef('upcoming', $upcoming); } $this->assignRef('params', $params); $this->assignRef('macro', $macro); $this->assignRef('event', $event); $this->assignRef('attendants', $attendants); $this->assign('confirmed_roles', $model->getConfirmedRoles($attendants)); $this->assign('xml_history', $model->getHistory($event->raid_id, true)); $this->assign('roles', $model->getRoles()); $this->assignRef('characters', $characters); $this->assignRef('all_characters', $all_characters); $this->assign('selfstatus', $model->getUserStatus($event->raid_id)); $this->assignRef('isOfficer', $isOfficer); $this->assign('canSignup', $model->userCanSignUp($event->raid_id)); $this->assign('onvacation', $model->usersOnVacation($event->start_time)); $this->assignRef('finished', $event->finished); $this->assign('canRate', $model->userCanRate($event->raid_id)); $this->assign('ratings', $model->getRates($event->raid_id)); parent::display($tpl); } }
# Website: http://www.taracque.hu/raidplanner -------------------------------------------------------------------------*/ // no direct access defined('_JEXEC') or die('Restricted access'); JHtml::_('behavior.modal', 'a.open-modal'); // register RaidPlanner Helper JLoader::register('RaidPlannerHelper', JPATH_ADMINISTRATOR . '/components/com_raidplanner/helper.php'); // include the helper file require_once dirname(__FILE__) . '/helper.php'; JFactory::getLanguage()->load('com_raidplanner', JPATH_SITE); //get user ID $user = JFactory::getUser(); $user_id = $user->id; // get the parameters from the module's configuration $alertTimer = $params->get('alertTimer', 24); $showInvitationAlerts = $params->get('showInvitationAlert', 0); $raidshowNumber = $params->get('raidshowNumber', 5); $raidshowReg = $params->get('raidshowReg', 1); $raidshowRole = $params->get('raidshowRole', 1); $raidshowChar = $params->get('raidshowChar', 1); $raidshowAttendants = $params->get('raidshowAttendants', 0); $itemid = RaidPlannerHelper::getRaidPlannerItemId('calendar'); if ($showInvitationAlerts > 0) { $invitationAlerts = RaidPlannerHelper::checkInvitations(intval($alertTimer) * 60, $user_id); } else { $invitationAlerts = false; } // get the items to display from the helper $items = modRaidPlannerEventsHelper::getItems($raidshowNumber, $user_id); // include the template for display require JModuleHelper::getLayoutPath('mod_raidplanner_events');
getStats(); }); </script> <div id="filter-bar" class="btn-toolbar"> <div class="filter-search btn-group pull-left"> <label for="start_time_min" class="element-invisible"><?php echo JText::_('JDATE'); ?> </label> <div class="input-append input-prepend"> <?php echo JHTML::_('calendar', RaidPlannerHelper::getDate(strtotime('-3 month'), null, RaidPlannerHelper::sqlDateFormat()), 'start_time', 'start_time', '%Y-%m-%d', array('class' => 'input-small')); ?> <span class="add-on">-</span> <?php echo JHTML::_('calendar', RaidPlannerHelper::getDate('now', null, RaidPlannerHelper::sqlDateFormat()), 'end_time', 'end_time', '%Y-%m-%d', array('class' => 'input-small')); ?> </div> </div> <div class="filter-search btn-group pull-left"> <?php if ($this->by_chars == 1) { ?> <label for="character_id" class="element-invisible"><?php echo JText::_('COM_RAIDPLANNER_CHARACTER'); ?> </label> <select name="character_id" id="character_id" class="input-normal"> <option></option> <?php foreach ($this->characters as $character_id => $character) {
?> "> <?php } ?> <?php if (substr($item->start_time, 0, 10) != date('Y-m-d')) { ?> <?php echo JHTML::_('date', $item->start_time, 'm-d'); ?> <?php } ?> <?php echo RaidPlannerHelper::raidTooltip($item->raid_id, $raidshowAttendants, $tip); ?> <?php if ($item->signed) { ?> <span class="icon-checkmark"></span> <?php } else { ?> <?php if ($item->invited) { ?> <span class="icon-question"></span> <?php } ?>
/** * Method to store a record * * @access public * @return boolean True on success */ function store() { $row = $this->getTable(); $data = JRequest::get('post'); if ($data['params']) { $data['params'] = json_encode($data['params']); } else { $data['params'] = ''; } // Bind the form fields to the table if (!$row->bind($data)) { $this->setError($this->_db->getErrorMsg()); return false; } if ($this->_id == 0) { $this->_id = $row->guild_id; } // Make sure the record is valid if (!$row->check()) { $this->setError($this->_db->getErrorMsg()); return false; } // Store the web link table to the database if (!$row->store()) { $this->setError($this->_db->getErrorMsg()); return false; } if (@$data['sync_now'] == '1') { RaidPlannerHelper::RosterSync($data['guild_id'], 0, true); } return $row->guild_id; }
</thead> <tbody> <?php foreach ($this->attendants as $attendant) { ?> <tr> <td class="<?php echo $attendant->class_css; ?> "> <input type="hidden" name="characters[]" value="<?php echo $attendant->character_id; ?> " /> <a href="<?php if ($guild_plugin = RaidPlannerHelper::getGuildPlugin($attendant->guild_id)) { echo implode(" ", $guild_plugin->trigger('onRPGetCharacterLink', array($attendant->char_name))); } else { echo '#" onclick="javascript:rpShowTooltip(\'att_char_name_' . $attendant->character_id . '\');return false;" '; } ?> " onmouseenter="javascript:rpShowTooltip('att_char_name_<?php echo $attendant->character_id; ?> ');" id="att_char_name_<?php echo $attendant->character_id; ?> " style="color:<?php echo $attendant->class_color; ?> " class="rp_tooltips" title="<?php
<?php echo JHTML::_('grid.sort', 'COM_RAIDPLANNER_TEMPLATE', 'r.is_template', $this->lists['order_Dir'], $this->lists['order']); ?> </th> <th width="5%"> <?php echo JHtml::_('grid.sort', 'JGRID_HEADING_ID', 'r.id', $this->lists['order_Dir'], $this->lists['order']); ?> </th> </tr> </thead> <tbody> <?php $k = 0; $i = 0; $ranks = RaidPlannerHelper::getRanks(); foreach ($this->raids as &$row) { $checked = JHTML::_('grid.id', $i++, $row->raid_id); ?> <tr class="<?php echo "row{$k}"; ?> "> <td> <?php echo $checked; ?> </td> <td> <?php echo JHTML::_('date', $row->start_time, JText::_('DATE_FORMAT_LC4') . " H:i");
/** * Returns a field in specified format * * @param moscomprofilerFields $field * @param moscomprofilerUser $user * @param string $output 'html', 'xml', 'json', 'php', 'csvheader', 'csv', 'rss', 'fieldslist', 'htmledit' * @param string $reason 'profile' for user profile view, 'edit' for profile edit, 'register' for registration, 'list' for user-lists * @param int $list_compare_types IF reason == 'search' : 0 : simple 'is' search, 1 : advanced search with modes, 2 : simple 'any' search * @return mixed */ function getField(&$field, &$user, $output, $reason, $list_compare_types) { $oReturn = ''; if (is_object($user)) { switch ($output) { case 'htmledit': $oReturn = null; if ($reason == 'edit' || $reason == 'register') { $value = $user->get($field->name); // Load language file JFactory::getLanguage()->load('com_raidplanner', JPATH_SITE); // Load the javascript JHtml::_('behavior.modal', 'a.open-modal'); // Build the script. $script = array(); $script[] = ''; $script[] = ' function jRecalCharacterValue_' . $field->fieldid . '() {'; $script[] = ' var ul = document.id("rp_characterEditorList_' . $field->fieldid . '");'; $script[] = ' var val = "";'; $script[] = ' ul.getChildren("li").each(function(li){'; $script[] = ' if (li.get("id") && (li.get("id") != "rp_characterEditorField_' . $field->fieldid . '_0") && (li.getChildren("a").get("text") != "") ) {'; $script[] = ' if (li.getChildren("input")[0].get("value")) {'; $script[] = ' val = val + li.getChildren("input")[0].get("value") + ":";'; $script[] = ' }'; $script[] = ' val = val + li.getChildren("a")[0].get("text") + ";";'; $script[] = ' }'; $script[] = ' })'; $script[] = ' document.id("rp_characterEditorValue_' . $field->fieldid . '").set("value", val );'; $script[] = ' }'; $script[] = ''; $script[] = ' function jSelectCharacter_' . $field->fieldid . '(idx, char_id, char_name) {'; $script[] = ' var line = document.id( "rp_characterEditorField_' . $field->fieldid . '_" + idx );'; $script[] = ' if (idx==0) {'; $script[] = ' var ul = line.getParent("ul");'; $script[] = ' ul.getChildren("li").each(function(li){'; $script[] = ' if ( (li) && (li.get("id")) ) {'; $script[] = ' if(li.get("id").replace("rp_characterEditorField_' . $field->fieldid . '_","")*1>idx) idx=li.get("id").replace("rp_characterEditorField_' . $field->fieldid . '_","")*1;'; $script[] = ' if(li.get("id") == "rp_characterEditorField_' . $field->fieldid . '_0") {'; $script[] = ' line = li.clone().setStyle("display","block");'; $script[] = ' }'; $script[] = ' }'; $script[] = ' })'; $script[] = ' idx = Number(idx) + 1;'; $script[] = ' line.set("id","rp_characterEditorField_' . $field->fieldid . '_" + (idx));'; $script[] = ' ul.grab(line,"top");'; $script[] = ' if (SqueezeBox) {'; $script[] = ' if (SqueezeBox.assign) {'; $script[] = ' SqueezeBox.assign(line.getChildren("a"),{parse:"rel"});'; $script[] = ' } else {'; $script[] = ' line.getChildren("a").each(function(el){'; $script[] = ' el.addEvent("click",function(e){'; $script[] = ' SqueezeBox.fromElement(el,{parse:"rel"});'; $script[] = ' });'; $script[] = ' });'; $script[] = ' }'; $script[] = ' }'; $script[] = ' }'; $script[] = ' line.getChildren("a")[0].set("text",char_name);'; $script[] = ' line.getChildren("a")[0].set("href","' . JURI::root() . 'index.php?option=com_raidplanner&view=character&layout=modal&tmpl=component&function=jSelectCharacter_' . $field->fieldid . '&character=" + char_name + "&char_id=" + char_id + "&fieldidx=" + idx );'; $script[] = ' line.getChildren("input")[0].set("value",char_id);'; $script[] = ' SqueezeBox.close();'; $script[] = ' jRecalCharacterValue_' . $field->fieldid . '();'; $script[] = ' }'; // Add the script to the document head. JFactory::getDocument()->addScriptDeclaration(implode("\n", $script)); $chars = RaidPlannerHelper::getProfileChars($value, true, true); $html = '<input type="hidden" name="' . $field->name . '" value="' . htmlspecialchars($value, ENT_COMPAT, 'UTF-8') . '" id="rp_characterEditorValue_' . $field->fieldid . '" />'; $html .= '<div style="width:' . $field->params->get('cols', 40) . 'em;height:' . $field->params->get('rows', 5) . 'em;overflow-y:auto;overflow-x:hidden;border:1px inset gray;">'; $html .= '<ul style="display:block;float:left;clear:left;width:100%;padding:0;margin:0;" id="rp_characterEditorList_' . $field->fieldid . '">'; $idx = 0; $html .= '<li style="display:none;float:left;clear:left;width:100%;padding:0;border-bottom:1px solid gray;background-image:none;" id="rp_characterEditorField_' . $field->fieldid . '_0">'; $html .= '<img src="' . JURI::root() . 'media/com_raidplanner/images/delete.png" alt="' . JText::_('JACTION_DELETE') . '" onclick="this.getParent(\'li\').dispose();" style="float:right;margin:0;" />'; $html .= '<a class="open-modal" href="" rel="{handler: \'iframe\', size: {x: 450, y: 300}}"></a>'; $html .= '<input type="hidden" value="" />'; $html .= '</li>'; foreach ($chars as $char) { $idx++; $link = JURI::root() . 'index.php?option=com_raidplanner&view=character&layout=modal&tmpl=component&function=jSelectCharacter_' . $field->fieldid . '&character=' . htmlspecialchars($char['char_name'], ENT_COMPAT, 'UTF-8') . '&char_id=' . intval($char['char_id']) . '&fieldidx=' . $idx; $html .= '<li style="display:block;float:left;clear:left;width:100%;padding:0;border-bottom:1px solid gray;background-image:none;" id="rp_characterEditorField_' . $field->fieldid . '_' . $idx . '">'; $html .= '<img src="' . JURI::root() . 'media/com_raidplanner/images/delete.png" alt="' . JText::_('JACTION_DELETE') . '" onclick="this.getParent(\'li\').dispose();jRecalCharacterValue_' . $field->fieldid . '();" style="float:right;margin:0;" />'; $html .= '<a class="open-modal" href="' . $link . '" rel="{handler: \'iframe\', size: {x: 450, y: 300}}">' . $char['char_name'] . '</a>'; if ($char['guild_name'] != '') { $html .= '<span> ‹' . $char['guild_name'] . '›</span>'; } $html .= '<input type="hidden" value="' . $char['char_id'] . '" />'; $html .= '</li>'; } $link = JURI::root() . 'index.php?option=com_raidplanner&view=character&layout=modal&tmpl=component&function=jSelectCharacter_' . $field->fieldid . '&character=&char_id=&fieldidx='; $html .= '<li style="display:block;float:left;clear:left;width:100%;padding:0;background-image:none;"><a class="open-modal" rel="{handler: \'iframe\', size: {x: 450, y: 300}}" href="' . $link . '"><img src="' . JURI::root() . 'media/com_raidplanner/images/new.png" alt="' . JText::_('COM_RAIDPLANNER_ADD_NEW_CHARACTER') . '" style="margin:0;" /> ' . JText::_('COM_RAIDPLANNER_ADD_NEW_CHARACTER') . '</a></li>'; $html .= '</ul>'; $html .= '</div>'; $oReturn = $html; } else { $oReturn = parent::getField($field, $user, $output, $reason, $list_compare_types); } break; case 'html': case 'rss': $value = $user->get($field->name); $chars = RaidPlannerHelper::getProfileChars($value, true, true); $oReturn = ''; foreach ($chars as $char) { $oReturn .= '<span class="' . $char['class_css'] . ' ' . $char['race_css'] . '">' . $char['char_name'] . '<span>'; if ($char['guild_name'] != '') { $oReturn .= ' ‹' . $char['guild_name'] . '›'; } $oReturn .= "\n"; } $oReturn = str_replace("\n", "<br />", trim($oReturn)); break; case 'json': case 'php': case 'xml': case 'csvheader': case 'fieldslist': case 'csv': default: $oReturn = parent::getField($field, $user, $output, $reason, $list_compare_types); break; } } return $oReturn; }
<?php /*------------------------------------------------------------------------ # Preview Template for RaidPlanner Component # com_raidplanner - RaidPlanner Component # ------------------------------------------------------------------------ # author Taracque # copyright Copyright (C) 2011 Taracque. All Rights Reserved. # @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL # Website: http://www.taracque.hu/raidplanner -------------------------------------------------------------------------*/ // no direct access defined('_JEXEC') or die('Restricted access'); $dateFormat = RaidPlannerHelper::shortDateFormat(); ?> <fieldset class="rp_preview"> <legend><?php echo JText::_('COM_RAIDPLANNER_PREVIEW'); ?> </legend> <table class="rp_container"> <tr class="rp_event_details"> <td> <?php if (@$this->event->icon_name) { ?> <img src="<?php echo JURI::base() . "media/com_raidplanner/raid_icons/" . $this->event->icon_name; ?> " float="left" style="float:left; margin: 0 5px 5px 0;" /> <?php