Exemplo n.º 1
0
        $searchresults = cge_array::extract_field($searchresults, 'event_id');
    }
}
$tpl = $this->CreateSmartyTemplate($thetemplate, 'searchresult_');
// calculate pagination stuff
// and the subset of event ids.
$numpages = 0;
$num_matches = 0;
if (!empty($searchresults)) {
    $num_matches = count($searchresults);
    $numpages = (int) (count($searchresults) / $limit);
    if (count($searchresults) % $limit > 0) {
        $numpages++;
    }
    $startoffset = ($pagenum - 1) * $limit;
    $entries = cgcalendar_utils::expand_events($searchresults, $returnid, $params, $limit, $startoffset);
    if (is_array($entries) && count($entries)) {
        $parms = $params;
        if ($pagenum > 1) {
            $parms['cal_pagenum'] = $pagenum - 1;
            $tpl->assign('prevpage_url', $this->CreateURL($id, 'searchresults', $returnid, $parms));
            $parms['cal_pagenum'] = 1;
            $tpl->assign('firstpage_url', $this->CreateURL($id, 'searchresults', $returnid, $parms));
        }
        if ($pagenum < $numpages) {
            $parms['cal_pagenum'] = $pagenum + 1;
            $tpl->assign('nextpage_url', $this->CreateURL($id, 'searchresults', $returnid, $parms));
            $parms['cal_pagenum'] = $numpages;
            $tpl->assign('lastpage_url', $this->CreateURL($id, 'searchresults', $returnid, $parms));
        }
        $tpl->assign('events', $entries);
// deprecated
$navigation['ni_next'] = $this->CreateURL($id, 'default', $returnid, $parms, false);
$navigation['in_next'] = $this->CreateURL($id, 'default', $returnid, $parms, true);
$parms['week'] = $reverse ? $week + 1 : $week - 1;
$navigation['prev'] = $this->CreateURL($id, 'default', $returnid, $parms, $inline);
// deprecated
$navigation['ni_prev'] = $this->CreateURL($id, 'default', $returnid, $parms, false);
$navigation['in_prev'] = $this->CreateURL($id, 'default', $returnid, $parms, true);
$parms['week'] = date('W');
$parms['year'] = date('Y');
$navigation['current'] = $this->CreateURL($id, 'default', $returnid, $parms, $inline);
// deprecated
$navigation['ni_current'] = $this->CreateURL($id, 'default', $returnid, $parms, false);
$navigation['in_current'] = $this->CreateURL($id, 'default', $returnid, $parms, true);
$day_names = $this->GetDayNames();
$day_short_names = $this->GetDayShortNames();
// assign to Smarty
$thetemplate = $this->GetPreference(CGCALENDAR_PREF_DFLTLIST_TEMPLATE);
$thetemplate = \cge_param::get_string($params, 'listtemplate', $thetemplate);
$tpl = $this->CreateSmartyTemplate($thetemplate, 'list_');
$tpl->assign('start_date_ut', $start_ut);
$tpl->assign('end_date_ut', $end_ut);
$tpl->assign('day_names', $day_names);
$tpl->assign('day_short_names', $day_short_names);
$tpl->assign('events', $events);
$tpl->assign('year', $year);
$tpl->assign('week', $week);
$tpl->assign('lang', $this->GetLabels());
$tpl->assign('navigation', $navigation);
$tpl->assign('file_location', cgcalendar_utils::get_upload_location());
$tpl->display();
Exemplo n.º 3
0
#-------------------------------------------------------------------------
#END_LICENSE
if (!isset($gCms)) {
    die;
}
$this->SetCurrentTab('defaultadmin');
$event_ids = array();
if (isset($params['tag'])) {
    $event_ids = $params['tag'];
}
if (count($event_ids) == 0) {
    $this->SetError($this->Lang('error_nothingselected'));
    $this->RedirectToAdminTab();
}
$ndeleted = 0;
foreach ($event_ids as $event_id) {
    $res = cgcalendar_utils::delete_event($event_id);
    if ($res) {
        $ndeleted++;
    }
}
if ($ndeleted == 0) {
    $this->SetError($this->Lang('error_nonedeleted'));
} else {
    if ($ndeleted < count($event_ids)) {
        $this->SetError($this->Lang('error_somedeleted'));
    } else {
        $this->SetMessage($this->Lang('taggeddeleted'));
    }
}
$this->RedirectToAdminTab();
Exemplo n.º 4
0
# Or read it online: http://www.gnu.org/licenses/licenses.html#GPL
#
#-------------------------------------------------------------------------
#END_LICENSE
if (!isset($gCms)) {
    exit;
}
//
// safety checks
//
$feu = $this->GetModuleInstance('FrontEndUsers');
if (!$feu) {
    $this->RedirectContent($returnid);
} else {
    if (!$feu->LoggedIn()) {
        $this->RedirectContent($returnid);
    }
}
if (!isset($params['event_id'])) {
    $this->RedirectContent($returnid);
}
$feu_uid = $feu->LoggedInId();
$query = 'SELECT event_id FROM ' . $this->events_table_name . ' WHERE event_id = ? AND event_created_by = ?';
$tmp = $db->GetOne($query, array((int) $params['event_id'], $feu_uid));
if ($tmp == $params['event_id']) {
    $res = cgcalendar_utils::delete_event($tmp);
}
$this->RedirectContent($returnid);
#
# EOF
#
Exemplo n.º 5
0
 function GetMonthNames()
 {
     $tmp = cgcalendar_utils::get_locale_dates();
     $month_names = $tmp['monthNames'];
     return $month_names;
 }
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# Or read it online: http://www.gnu.org/licenses/licenses.html#GPL
#
#-------------------------------------------------------------------------
#END_LICENSE
if (!$gCms) {
    exit;
}
if (!$this->CheckPermission('Modify Calendar') && !$this->CheckPermission('Add Calendar Events') && !$this->CheckPermission('Edit My Calendar Events')) {
    return;
}
// get the locale specified dates
$locale_info = cgcalendar_utils::get_locale_dates();
foreach ($locale_info as $key => &$value) {
    $value = json_encode($value);
}
$smarty->assign('firstdayofweek', (int) $this->GetPreference('firstdayofweek', 1));
$smarty->assign('datestrings', $locale_info);
$smarty->assign('text_week', $this->Lang('week'));
$smarty->assign('text_month', $this->Lang('month'));
$smarty->assign('text_day', $this->Lang('day'));
$smarty->assign('text_today', $this->Lang('today'));
$smarty->assign('dflt_fgcolor', $this->GetPreference('dflt_fgcolor', '#ffffff'));
$smarty->assign('dflt_bgcolor', $this->GetPreference('dflt_bgcolor', '#009900'));
$smarty->assign('holiday_fgcolor', $this->GetPreference('holidayfgcolor', '#000000'));
$smarty->assign('holiday_bgcolor', $this->GetPreference('holidaybgcolor', '#ccffff'));
$categories = $this->GetCategories();
if (is_array($categories) && count($categories)) {
}
if (isset($params['do_get_from_params']) && $params['do_get_from_params'] == 1) {
    $this->GetEventFromParams($event, $params);
}
$extra = "";
if ($this->GetPreference("force_category") == 1) {
    $extra = "onsubmit='for(i=0;i<" . count($categories) . ";i++){var name=\"category\"+i; var element=document.getElementById(name); if (element.checked) return true;}; alert(\"" . $this->Lang("category_reminder") . "\"); return false;'";
}
$smarty->assign('formstart', $this->CreateFormStart($id, 'admin_event_update', $returnid, $method = 'post', $enctype = 'multipart/form-data', false, "", array(), $extra));
$smarty->assign('hidden', $this->CreateInputHidden($id, 'event_id', $event_id));
$current_year = date('Y');
$start = $current_year - $this->GetPreference('showpastyears', 2);
$end = $current_year + $this->GetPreference('showfutureyears', 10);
$smarty->assign('start_year', $start);
$smarty->assign('end_year', $end);
$tmp = cgcalendar_utils::get_username($event['event_created_by']);
if ($tmp) {
    $event['owner_name'] = $tmp;
}
$smarty->assign('event', $event);
$event_date_start_ut = time();
if (isset($params['startdate_Hour'])) {
    $event_date_start_ut = mktime($params['startdate_Hour'], $params['startdate_Minute'], 0, $params['startdate_Month'], $params['startdate_Day'], $params['startdate_Year']);
}
$event_date_end_ut = 0;
if (isset($params['enddate_Hour'])) {
    $event_date_end_ut = mktime($params['enddate_Hour'], $params['enddate_Minute'], 59, $params['enddate_Month'], $params['enddate_Day'], $params['enddate_Year']);
}
$event_recur_period = 'none';
if (isset($event['event_recur_period'])) {
    $event_recur_period = $event['event_recur_period'];
# as an addon module to CMS Made Simple.  You may not use this software
# in any Non GPL version of CMS Made simple, or in any version of CMS
# Made simple that does not indicate clearly and obviously in its admin
# section that the site was built with CMS Made simple.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# Or read it online: http://www.gnu.org/licenses/licenses.html#GPL
#
#-------------------------------------------------------------------------
#END_LICENSE
if (!isset($gCms)) {
    return;
}
if (!isset($params['event_id'])) {
    return;
}
die('not used');
$this->SetCurrentTab('defaultadmin');
$res = cgcalendar_utils::delete_event($params['event_id']);
if (!$res) {
    $this->SetError($this->Lang('error_deletefailed'));
} else {
    $this->SetMessage($this->Lang('eventdeleted'));
}
$this->RedirectToAdminTab();