コード例 #1
0
ファイル: User.php プロジェクト: par-orillonsoft/phpwebsite
 /**
  * Returns a set of links to navigate the different calendar views
  *
  * @param string current_view   Name of the current view
  * @return string
  */
 public function viewLinks($current_view)
 {
     if (!$this->calendar->schedule->id) {
         return null;
     }
     $no_follow = PHPWS_Settings::get('calendar', 'no_follow');
     $vars = PHPWS_Text::getGetValues();
     unset($vars['module']);
     //        if ($current_view == 'grid') {
     //            $vars['date'] = $this->calendar->today;
     //        }
     if (isset($_REQUEST['m']) && isset($_REQUEST['y']) && isset($_REQUEST['d'])) {
         $vars['date'] = mktime(0, 0, 0, $_REQUEST['m'], $_REQUEST['d'], $_REQUEST['y']);
         unset($vars['m']);
         unset($vars['d']);
         unset($vars['y']);
     }
     $links['today'] = $this->todayLink($current_view);
     if ($current_view == 'event') {
         $vars['date'] = $this->event->start_time;
     }
     if (isset($this->calendar->schedule)) {
         $vars['sch_id'] = $this->calendar->schedule->id;
     }
     // Get the values for the left and right arrows in a month view
     if ($current_view == 'list' || $current_view == 'grid') {
         $oMonth = $this->calendar->getMonth();
         $left_arrow_time = $oMonth->prevMonth('timestamp');
         $right_arrow_time = $oMonth->nextMonth('timestamp');
         $left_link_title = dgettext('calendar', 'Previous month');
         $right_link_title = dgettext('calendar', 'Next month');
     }
     if ($current_view == 'grid') {
         //$links['GRID'] = dgettext('calendar', 'Grid');
     } else {
         $vars['view'] = 'grid';
         $glink = new PHPWS_Link(dgettext('calendar', 'Month Grid'), 'calendar', $vars);
         $glink->setNoFollow($no_follow);
         $glink->addClass('btn btn-default');
         $links['GRID'] = $glink->get();
     }
     if ($current_view == 'list') {
         //$links['LIST'] = dgettext('calendar', 'Month');
     } else {
         $vars['view'] = 'list';
         $glink = new PHPWS_Link(dgettext('calendar', 'Month list'), 'calendar', $vars);
         $glink->addClass('btn btn-default');
         $glink->setNoFollow($no_follow);
         $links['LIST'] = $glink->get();
     }
     if ($current_view == 'week') {
         require_once 'Calendar/Week.php';
         $oWeek = $this->calendar->getWeek();
         $left_arrow_time = $oWeek->prevWeek('timestamp');
         $right_arrow_time = $oWeek->nextWeek('timestamp');
         $left_link_title = dgettext('calendar', 'Previous week');
         $right_link_title = dgettext('calendar', 'Next week');
     } else {
         $vars['view'] = 'week';
         $wlink = new PHPWS_Link(dgettext('calendar', 'Week'), 'calendar', $vars);
         $wlink->setNoFollow($no_follow);
         $wlink->addClass('btn btn-default');
         $links['WEEK'] = $wlink->get();
     }
     if ($current_view == 'day') {
         require_once 'Calendar/Day.php';
         $oDay = new Calendar_Day($this->calendar->int_year, $this->calendar->int_month, $this->calendar->int_day);
         $left_arrow_time = $oDay->prevDay('timestamp');
         $right_arrow_time = $oDay->nextDay('timestamp');
         $left_link_title = dgettext('calendar', 'Previous day');
         $right_link_title = dgettext('calendar', 'Next day');
         $links['DAY_LINK'] = dgettext('calendar', 'Day');
     } else {
         $vars['view'] = 'day';
         $dlink = new PHPWS_Link(dgettext('calendar', 'Day'), 'calendar', $vars);
         $dlink->addClass('btn btn-default');
         $dlink->setNoFollow($no_follow);
         $links['DAY_LINK'] = $dlink->get();
     }
     $vars['view'] = $current_view;
     if (!empty($left_arrow_time)) {
         $vars['date'] = $left_arrow_time;
         $larrow = new PHPWS_Link('<i class="fa fa-chevron-left"></i>&nbsp;', 'calendar', $vars);
         $larrow->addClass('btn btn-default');
         $larrow->setTitle($left_link_title);
         $larrow->setNoFollow($no_follow);
         $links['LEFT_ARROW'] = $larrow->get();
     }
     if (!empty($right_arrow_time)) {
         $vars['date'] = $right_arrow_time;
         $rarrow = new PHPWS_Link('&nbsp;<i class="fa fa-chevron-right"></i>', 'calendar', $vars);
         $rarrow->addClass('btn btn-default');
         $rarrow->setTitle($right_link_title);
         $rarrow->setNoFollow($no_follow);
         $links['RIGHT_ARROW'] = $rarrow->get();
     }
     return $links;
 }
コード例 #2
0
 public function getLinkValues()
 {
     $output = null;
     if (isset($GLOBALS['DBPager_Link_Values'])) {
         return $GLOBALS['DBPager_Link_Values'];
     }
     if (empty($this->limit)) {
         $this->limit = DBPAGER_DEFAULT_LIMIT;
     }
     $values['pg'] = $this->current_page;
     $values['limit'] = $this->limit;
     if (!empty($this->search)) {
         $values['pager_search'] = $this->search;
     }
     if (isset($this->orderby)) {
         $values['orderby'] = $this->orderby;
         if (isset($this->orderby_dir)) {
             $values['orderby_dir'] = $this->orderby_dir;
         }
     }
     // pull get values from link setting
     if (!empty($this->link)) {
         $url = parse_url($this->link);
         if (isset($url['query'])) {
             parse_str(str_replace('&amp;', '&', $url['query']), $output);
         }
     }
     // pull any extra values in current url
     $extra = \PHPWS_Text::getGetValues();
     $search_val =& $extra['search'];
     if (UTF8_MODE) {
         $preg = '/[^\\w\\s\\pL]/u';
     } else {
         $preg = '/[^\\w\\s]/u';
     }
     $search_val = preg_replace($preg, '', $search_val);
     $search_val = preg_replace('/\\s/', '+', $search_val);
     // if extra values exist, add them to the values array
     // ignore matches in the output and other values
     if (!empty($extra)) {
         if ($output) {
             $diff = array_diff_assoc($extra, $output);
         } else {
             $diff = $extra;
         }
         $diff = array_diff_assoc($diff, $values);
         $values = array_merge($diff, $values);
     }
     if ($output) {
         $values = array_merge($output, $values);
     }
     // prevents a doubling of the value in the page form
     unset($values['change_page']);
     unset($values['pager_c_search']);
     // Don't need the Go button from search to be carried along
     unset($values['go']);
     if (empty($values['module'])) {
         $values['module'] = $this->module;
     }
     $GLOBALS['DBPager_Link_Values'] = $values;
     return $values;
 }
コード例 #3
0
ファイル: Current_User.php プロジェクト: HaldunA/phpwebsite
 public static function verifySaltedUrl()
 {
     $val = PHPWS_Text::getGetValues();
     unset($val['module']);
     unset($val['authkey']);
     unset($val['owpop']);
     $serial_url = str_replace(' ', '+', serialize($val));
     return Current_User::verifyAuthKey($serial_url);
 }