Exemplo n.º 1
0
    /**
     * Method to get the field input markup.
     *
     * @return	string	The field input markup.
     * @since	1.6
     */
    protected function getInput()
    {
        ob_start();
        $event = $this->form->jevdata[$this->name]["event"];
        $eventfield = $this->name == "publish_up" ? "startDate" : "endDate";
        $params = JComponentHelper::getParams(JEV_COM_COMPONENT);
        $minyear = JEVHelper::getMinYear();
        $maxyear = JEVHelper::getMaxYear();
        $inputdateformat = $params->get("com_editdateformat", "d.m.Y");
        static $firsttime;
        if (!defined($firsttime)) {
            $document = JFactory::getDocument();
            $js = "\neventEditDateFormat='{$inputdateformat}';//Date.defineParser(eventEditDateFormat.replace('d','%d').replace('m','%m').replace('Y','%Y'));";
            $document->addScriptDeclaration($js);
            $firsttime = false;
        }
        $cal = JEVHelper::loadCalendar($this->name, $this->name, $event->{$eventfield}(), $minyear, $maxyear, 'var elem =jevjq(this);' . $this->element['onhidestart'], "var elem = jevjq(this);" . $this->element['onchange'], $inputdateformat);
        echo $cal;
        ?>
		<input type="hidden"  name="<?php 
        echo $this->name;
        ?>
2" id="<?php 
        echo $this->name;
        ?>
2" value="" />
		<?php 
        $html = ob_get_clean();
        JLoader::register('JEVHelper', JPATH_SITE . "/components/com_jevents/libraries/helper.php");
        JEVHelper::ConditionalFields($this->element, $this->form->getName());
        return $html;
    }
Exemplo n.º 2
0
 function getAdjacentYear($year, $month, $day, $direction = 1)
 {
     $d1 = JevDate::mktime(0, 0, 0, $month, $day, $year + $direction);
     $day = JevDate::strftime("%d", $d1);
     $year = JevDate::strftime("%Y", $d1);
     $params = JComponentHelper::getParams(JEV_COM_COMPONENT);
     $cfg = JEVConfig::getInstance();
     if (method_exists("JEVHelper", "getMinYear")) {
         $earliestyear = JEVHelper::getMinYear();
         $latestyear = JEVHelper::getMaxYear();
     } else {
         $earliestyear = $params->get("com_earliestyear", 1970);
         $latestyear = $params->get("com_latestyear", 2150);
     }
     if ($year > $latestyear || $year < $earliestyear) {
         return false;
     }
     $month = JevDate::strftime("%m", $d1);
     $task = JRequest::getString('jevtask');
     $Itemid = JEVHelper::getItemid();
     if (isset($Itemid)) {
         $item = "&Itemid={$Itemid}";
     } else {
         $item = "";
     }
     return JRoute::_("index.php?option=" . JEV_COM_COMPONENT . "&task={$task}{$item}&year={$year}&month={$month}&day={$day}");
 }
Exemplo n.º 3
0
 function fetchElement($name, $value, &$node, $control_name)
 {
     // Must load admin language files
     $lang = JFactory::getLanguage();
     $lang->load("com_jevents", JPATH_ADMINISTRATOR);
     $lang->load("com_jevents", JPATH_SITE);
     JLoader::register('JEVHelper', JPATH_SITE . "/components/com_jevents/libraries/helper.php");
     $option = "com_jevents";
     $params = JComponentHelper::getParams($option);
     $minyear = JEVHelper::getMinYear();
     $maxyear = JEVHelper::getMaxYear();
     ob_start();
     JEVHelper::loadCalendar($control_name . '[' . $name . ']', $control_name . $name, $value, $minyear, $maxyear, '', "", 'Y-m-d');
     return ob_get_clean();
 }
Exemplo n.º 4
0
 function listevents($tpl = null)
 {
     JEVHelper::componentStylesheet($this);
     $params = JComponentHelper::getParams(JEV_COM_COMPONENT);
     $value = trim($params->get("relstart", ""));
     if ($value != "") {
         $value = str_replace(",", " ", $value);
         $value = str_replace("y", "year", $value);
         $value = str_replace("d", "day", $value);
         $value = str_replace("w", "week", $value);
         $value = str_replace("m", "month", $value);
         $value = new JevDate($value);
         $startdate = $value->toFormat("%Y-%m-%d");
         list($startyear, $startmonth, $startday) = explode("-", $startdate);
     } else {
         $startyear = JEVHelper::getMinYear();
         $startdate = $startyear . "-01-01";
         $startmonth = 1;
         $startday = 1;
     }
     if ($value != "") {
         $value = trim($params->get("relend", ""));
         $value = str_replace(",", " ", $value);
         $value = str_replace("y", "year", $value);
         $value = str_replace("d", "day", $value);
         $value = str_replace("w", "week", $value);
         $value = str_replace("m", "month", $value);
         $value = new JevDate($value);
         $enddate = $value->toFormat("%Y-%m-%d");
         list($endyear, $endmonth, $endday) = explode("-", $enddate);
     } else {
         $endyear = JEVHelper::getMaxYear();
         $enddate = $endyear . "-12-31";
         $endmonth = 12;
         $endday = 31;
     }
     $this->assign("startdate", $startdate);
     $this->assign("startyear", $startyear);
     $this->assign("startmonth", $startmonth);
     $this->assign("startday", $startday);
     $this->assign("enddate", $enddate);
     $this->assign("endyear", $endyear);
     $this->assign("endmonth", $endmonth);
     $this->assign("endday", $endday);
     // Note that using a $limit value of -1 the limit is ignored in the query
     $this->assign("data", $this->datamodel->getRangeData($startdate, $enddate, $this->limit, $this->limitstart));
 }
Exemplo n.º 5
0
            $yt = $yt . " CHECKED";
            $checked = true;
        }
    }
    $yt = $yt . " /><strong>" . JText::_("JEV_EVENT_ALLYEARS") . "</strong><br/>\n";
    echo $yt;
    ?>
		<div id='otheryears' <?php 
    echo $checked ? 'style="display:none;max-height:100px;overflow-y:auto;"' : '';
    ?>
 >
			<?php 
    //consturc years array, easy to add own kind of selection
    $params = JComponentHelper::getParams(JEV_COM_COMPONENT);
    $year = array();
    for ($y = JEVHelper::getMinYear(); $y <= JEVHelper::getMaxYear(); $y++) {
        if (!in_array($y, $year)) {
            $year[] = $y;
        }
    }
    foreach ($year as $y) {
        $yt = "<input name=\"years[]\" type=\"checkbox\" value=\"" . $y . "\" onclick='clearAllIcalYears(this);' ";
        if (!JRequest::getVar('years', 0)) {
            //$yt = $yt . " CHECKED";
        } else {
            if (JRequest::getVar('years', 0) && in_array($y, JRequest::getVar('years', '', 'POST'))) {
                $yt = $yt . " CHECKED";
            }
        }
        $yt = $yt . " />" . $y . "<br/>\n";
        echo $yt;
Exemplo n.º 6
0
 function export()
 {
     $params = JComponentHelper::getParams(JEV_COM_COMPONENT);
     $years = JRequest::getVar('years', 'NONE');
     $cats = JRequest::getVar('catids', 'NONE');
     // validate the key
     $icalkey = $params->get("icalkey", "secret phrase");
     $outlook2003icalexport = JRequest::getInt("outlook2003", 0) && $params->get("outlook2003icalexport", 0);
     if ($outlook2003icalexport) {
         JRequest::setVar("icf", 1);
     }
     $privatecalendar = false;
     $k = JRequest::getString("k", "NONE");
     $pk = JRequest::getString("pk", "NONE");
     $userid = JRequest::getInt("i", 0);
     if ($pk != "NONE") {
         if (!$userid) {
             throw new Exception(JText::_('JEV_ERROR'), 403);
             return false;
         }
         $privatecalendar = true;
         $puser = JUser::getInstance($userid);
         $key = md5($icalkey . $cats . $years . $puser->password . $puser->username . $puser->id);
         if ($key != $pk) {
             throw new Exception(JText::_('JEV_ERROR'), 403);
             return false;
         }
         // ensure "user" can access non-public categories etc.
         $this->dataModel->aid = JEVHelper::getAid($puser);
         $this->dataModel->accessuser = $puser->get('id');
         $registry = JRegistry::getInstance("jevents");
         $registry->set("jevents.icaluser", $puser);
     } else {
         if ($k != "NONE") {
             if ($params->get("disableicalexport", 0)) {
                 throw new Exception(JText::_('ALERTNOTAUTH'), 403);
                 return false;
             }
             $key = md5($icalkey . $cats . $years);
             if ($key != $k) {
                 throw new Exception(JText::_('JEV_ERROR'), 403);
                 return false;
             }
         } else {
             throw new Exception(JText::_('JEV_ERROR'), 403);
             return false;
         }
     }
     // Fix the cats
     $cats = explode(',', $cats);
     // hardening!
     JEVHelper::forceIntegerArray($cats, false);
     if ($cats != array(0)) {
         JRequest::setVar("catids", implode("|", $cats));
     } else {
         JRequest::setVar("catids", '');
     }
     //Parsing variables from URL
     //Year
     // All years
     if ($years == 0) {
         $params = JComponentHelper::getParams(JEV_COM_COMPONENT);
         $years = array();
         for ($y = JEVHelper::getMinYear(); $y <= JEVHelper::getMaxYear(); $y++) {
             if (!in_array($y, $years)) {
                 $years[] = $y;
             }
         }
         JArrayHelper::toInteger($years);
     } else {
         if ($years != "NONE") {
             $years = explode(",", JRequest::getVar('years'));
             if (!is_array($years) || count($years) == 0) {
                 list($y, $m, $d) = JEVHelper::getYMD();
                 $years = array($y);
             }
             JArrayHelper::toInteger($years);
         } else {
             list($y, $m, $d) = JEVHelper::getYMD();
             $years = array($y);
         }
     }
     // Lockin hte categories from the URL
     $Itemid = JRequest::getInt("Itemid", 0);
     if (!$Itemid) {
         JRequest::setVar("Itemid", 1);
     }
     $this->dataModel->setupComponentCatids();
     $dispatcher = JDispatcher::getInstance();
     // just incase we don't have jevents plugins registered yet
     JPluginHelper::importPlugin("jevents");
     //And then the real work
     // Force all only the one repeat
     $cfg = JEVConfig::getInstance();
     $cfg->set('com_showrepeats', 0);
     $icalEvents = array();
     foreach ($years as $year) {
         $startdate = $year . "-01-01";
         $enddate = $year . "-12-31";
         $rows = $this->dataModel->getRangeData($startdate, $enddate, 0, 0);
         if (!isset($rows["rows"])) {
             continue;
         }
         foreach ($rows["rows"] as $row) {
             if (!array_key_exists($row->ev_id(), $icalEvents)) {
                 $dispatcher->trigger('onExportRow', array(&$row));
                 $icalEvents[$row->ev_id()] = $row;
             }
         }
         unset($rows);
     }
     if ($userid) {
         $user = JUser::getInstance($userid);
     }
     $mainframe = JFactory::getApplication();
     // get the view
     $this->view = $this->getView("icals", "html");
     $this->view->setLayout("export");
     $this->view->assign("dataModel", $this->dataModel);
     $this->view->assign("outlook2003icalexport", $outlook2003icalexport);
     $this->view->assign("icalEvents", $icalEvents);
     $this->view->assign("withrepeats", true);
     $this->view->export();
     return;
 }
Exemplo n.º 7
0
 public static function buildYearSelect($year, $args)
 {
     $y = date('Y');
     $cfg = JEVConfig::getInstance();
     $earliestyear = JEVHelper::getMinYear();
     $latestyear = JEVHelper::getMaxYear();
     if ($year < $y - 2 && $year >= $earliestyear && $year <= $latestyear) {
         $yearslist[] = JHTML::_('select.option', $year, $year);
     }
     for ($i = $y - 2; $i <= $y + 5; $i++) {
         if ($i >= $earliestyear && $i <= $latestyear) {
             $yearslist[] = JHTML::_('select.option', $i, $i);
         }
     }
     if ($year > $y + 5 && $year >= $earliestyear && $year <= $latestyear) {
         $yearslist[] = JHTML::_('select.option', $year, $year);
     }
     $tosend = JHTML::_('select.genericlist', $yearslist, 'year', $args, 'value', 'text', $year);
     echo $tosend;
 }
Exemplo n.º 8
0
    function _genericMonthNavigation($dates, $alts, $which, $icon)
    {
        $cfg = JEVConfig::getInstance();
        $task = $this->task;
        $link = 'index.php?option=' . JEV_COM_COMPONENT . '&task=' . $task . $this->cat . '&Itemid=' . $this->Itemid . '&';
        $gg = "<img border='0' src='" . JURI::root() . "components/" . JEV_COM_COMPONENT . "/views/default/assets/images/{$icon}" . "_" . $cfg->get('com_navbarcolor') . ".gif' alt='" . $alts[$which] . "'/>";
        $thelink = '<a href="' . JRoute::_($link . $dates[$which]->toDateURL()) . '" title="' . $alts[$which] . '">' . $gg . '</a>' . "\n";
        if ($dates[$which]->getYear() >= JEVHelper::getMinYear() && $dates[$which]->getYear() <= JEVHelper::getMaxYear()) {
            ?>
			<td class="w10px vmiddle" align="center"><?php 
            echo $thelink;
            ?>
</td>
			<?php 
        } else {
            ?>
			<td class="w10px vmiddle" align="center"></td>
			<?php 
        }
    }
 private function getAdjacentEvents()
 {
     $Itemid = JEVHelper::getItemid();
     list($year, $month, $day) = JEVHelper::getYMD();
     $this->datamodel = new JEventsDataModel();
     JLoader::register('JEVHelper', JPATH_SITE . "/components/com_jevents/libraries/helper.php");
     if (method_exists("JEVHelper", "getMinYear")) {
         $minyear = JEVHelper::getMinYear();
         $maxyear = JEVHelper::getMaxYear();
     } else {
         $params = JComponentHelper::getParams(JEV_COM_COMPONENT);
         $minyear = $params->get("com_earliestyear", 1970);
         $maxyear = $params->get("com_latestyear", 2150);
     }
     $pastev = 0;
     $limit = 10;
     while ($pastev == 0) {
         $prev = $this->datamodel->queryModel->listIcalEvents($minyear . '-01-01 00:00:00', $this->_startrepeat, "rpt.startrepeat DESC, rpt.rp_id DESC", false, "", "", $limit);
         for ($i = 0; $i < count($prev); $i++) {
             if ($this->_startrepeat > $prev[$i]->_startrepeat) {
                 $prior = $prev[$i];
                 $pastev = 1;
                 break;
             } else {
                 if ($prev[$i]->_rp_id < $this->_rp_id && $this->_startrepeat == $prev[$i]->_startrepeat) {
                     $prior = $prev[$i];
                     $pastev = 1;
                     break;
                 }
             }
         }
         if (count($prev) < $limit) {
             $pastev = 1;
         }
         $limit = $limit * 2;
     }
     if (!is_null($prior)) {
         $link = "index.php?option=" . JEV_COM_COMPONENT . "&task=" . $this->detailTask() . "&evid=" . $prior->_rp_id . '&Itemid=' . $Itemid . "&year=" . $prior->_yup . "&month=" . $prior->_mup . "&day=" . $prior->_dup . "&uid=" . urlencode($prior->_uid) . "&title=" . JApplication::stringURLSafe($prior->_title);
         $link = JRoute::_($link);
         $this->_prevEvent = $link;
     } else {
         $this->_prevEvent = false;
     }
     $pastevpost = 0;
     $limit = 10;
     while ($pastevpost == 0) {
         $next = $this->datamodel->queryModel->listIcalEvents($this->_startrepeat, $maxyear . '-01-01 00:00:00', "rpt.startrepeat ASC, rpt.rp_id ASC", false, "", "", $limit);
         for ($i = 0; $i < count($next); $i++) {
             if ($this->_startrepeat < $next[$i]->_startrepeat) {
                 $post = $next[$i];
                 $pastevpost = 1;
                 break;
             } else {
                 if ($next[$i]->_rp_id > $this->_rp_id && $this->_startrepeat == $next[$i]->_startrepeat) {
                     $post = $next[$i];
                     $pastevpost = 1;
                     break;
                 }
             }
         }
         if (count($next) < $limit) {
             $pastevpost = 1;
         }
         $limit = $limit * 2;
     }
     if (!is_null($post)) {
         $link = "index.php?option=" . JEV_COM_COMPONENT . "&task=" . $this->detailTask() . "&evid=" . $post->rp_id . '&Itemid=' . $Itemid . "&year={$post->yup}&month={$post->mup}&day={$post->dup}&uid=" . urlencode($this->uid()) . "&title=" . JApplication::stringURLSafe($post->title);
         $link = JRoute::_($link);
         $this->_nextEvent = $link;
     } else {
         $this->_nextEvent = false;
     }
 }
Exemplo n.º 10
0
?>
" onchange="checkInterval();" /><span id='count_label' style="margin-left:1em"><?php 
echo JText::_('REPEATS');
?>
</span>
			</fieldset>
		</div>
		<div style="float:left;margin-left:20px!important;background-color:#dddddd;" id="cu_until">
			<fieldset style="background-color:#dddddd">
				<legend  style="background-color:#dddddd"><input type="radio" name="countuntil" value="until" id="cuu" onclick="toggleCountUntil('cu_until');" /><?php 
echo JText::_('REPEAT_UNTIL');
?>
</legend>
				<?php 
$params = JComponentHelper::getParams(JEV_COM_COMPONENT);
$minyear = JEVHelper::getMinYear();
$maxyear = JEVHelper::getMaxYear();
$inputdateformat = $params->get("com_editdateformat", "d.m.Y");
JEVHelper::loadCalendar("until", "until", JevDate::strftime("%Y-%m-%d", $this->row->until()), $minyear, $maxyear, 'updateRepeatWarning();', "checkUntil();updateRepeatWarning();", $inputdateformat);
?>
				<input type="hidden"  name="until2" id="until2" value="" />

			</fieldset>
		</div>
	</div>
	<div style="clear:both;">
		<div   id="byyearday">
			<fieldset><legend><input type="radio" name="whichby" id="jevbyd" value="byd"  onclick="toggleWhichBy('byyearday');" /><?php 
echo JText::_('BY_YEAR_DAY');
?>
</legend>
Exemplo n.º 11
0
 function getAdjacentDay($year, $month, $day, $direction = 1)
 {
     $d1 = JevDate::mktime(0, 0, 0, $month, $day + $direction, $year);
     $day = JevDate::strftime("%d", $d1);
     $year = JevDate::strftime("%Y", $d1);
     $cfg = JEVConfig::getInstance();
     $earliestyear = JEVHelper::getMinYear();
     $latestyear = JEVHelper::getMaxYear();
     if ($year > $latestyear || $year < $earliestyear) {
         return false;
     }
     $month = JevDate::strftime("%m", $d1);
     $task = JRequest::getString('jevtask');
     $Itemid = JEVHelper::getItemid();
     if (isset($Itemid)) {
         $item = "&Itemid={$Itemid}";
     } else {
         $item = "";
     }
     // URL suffix to preserver catids!
     $cat = $this->getCatidsOutLink();
     return JRoute::_("index.php?option=" . JEV_COM_COMPONENT . "&task={$task}{$item}&year={$year}&month={$month}&day={$day}" . $cat);
 }
Exemplo n.º 12
0
    function _createfilterHTML()
    {
        if (!$this->filterField) {
            return "";
        }
        // only works on admin list events pages
        if (JRequest::getCmd("jevtask") != "admin.listevents") {
            $filterList = array();
            $filterList["title"] = "";
            $filterList["html"] = "";
            return $filterList;
        }
        $filterList = array();
        $filterList["title"] = JText::_('WITH_INSTANCES');
        $filterList["html"] = "";
        $options = array();
        $options[] = JHTML::_('select.option', '0', JText::_('WHEN'));
        $options[] = JHTML::_('select.option', '1', JText::_('On_or_after'));
        $options[] = JHTML::_('select.option', '-1', JText::_('BEFORE'));
        $filterList["html"] .= JHTML::_('select.genericlist', $options, $this->filterType . '_fvs0', 'onchange="form.submit()" class="inputbox" size="1" ', 'value', 'text', $this->filter_values[0]);
        //$filterList["html"] .=  JHTML::calendar($this->filter_values[1],$this->filterType.'_fvs1', $this->filterType.'_fvs1', '%Y-%m-%d',array('size'=>'12','maxlength'=>'10','onchange'=>'form.submit()'));
        $params = JComponentHelper::getParams(JEV_COM_COMPONENT);
        $minyear = JEVHelper::getMinYear();
        $maxyear = JEVHelper::getMaxYear();
        $document = JFactory::getDocument();
        $calendar = JevJoomlaVersion::isCompatible("3.0") ? 'calendar14.js' : 'calendar12.js';
        JEVHelper::script($calendar, "components/" . JEV_COM_COMPONENT . "/assets/js/", true);
        JEVHelper::stylesheet("dashboard.css", "components/" . JEV_COM_COMPONENT . "/assets/css/", true);
        $document->addScriptDeclaration('window.addEvent(\'domready\', function() {
				new NewCalendar({ ' . $this->filterType . '_fvs1 :  "Y-m-d"},{
					direction:0, 
					classes: ["dashboard"],
					draggable:true,
					navigation:2,
					tweak:{x:0,y:-75},
					offset:1,
					range:{min:' . $minyear . ',max:' . $maxyear . '},
					months:["' . JText::_("JEV_JANUARY") . '",
					"' . JText::_("JEV_FEBRUARY") . '",
					"' . JText::_("JEV_MARCH") . '",
					"' . JText::_("JEV_APRIL") . '",
					"' . JText::_("JEV_MAY") . '",
					"' . JText::_("JEV_JUNE") . '",
					"' . JText::_("JEV_JULY") . '",
					"' . JText::_("JEV_AUGUST") . '",
					"' . JText::_("JEV_SEPTEMBER") . '",
					"' . JText::_("JEV_OCTOBER") . '",
					"' . JText::_("JEV_NOVEMBER") . '",
					"' . JText::_("JEV_DECEMBER") . '"
					],
					days :["' . JText::_("JEV_SUNDAY") . '",
					"' . JText::_("JEV_MONDAY") . '",
					"' . JText::_("JEV_TUESDAY") . '",
					"' . JText::_("JEV_WEDNESDAY") . '",
					"' . JText::_("JEV_THURSDAY") . '",
					"' . JText::_("JEV_FRIDAY") . '",
					"' . JText::_("JEV_SATURDAY") . '"
					], 
					onHideComplete : function () { $("' . $this->filterType . '_fvs1").form.submit()},					
				});
			});');
        $filterList["html"] .= '<input type="text" name="' . $this->filterType . '_fvs1" id="' . $this->filterType . '_fvs1" value="' . $this->filter_values[1] . '" maxlength="10" size="12"  />';
        $filterList["html"] .= "<input type='hidden' name='" . $this->filterType . "_fvs2' value='1'/>";
        return $filterList;
    }