本文整理汇总了PHP中JEventsHTML::buildAccessSelect方法的典型用法代码示例。如果您正苦于以下问题:PHP JEventsHTML::buildAccessSelect方法的具体用法?PHP JEventsHTML::buildAccessSelect怎么用?PHP JEventsHTML::buildAccessSelect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JEventsHTML
的用法示例。
在下文中一共展示了JEventsHTML::buildAccessSelect方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edit
function edit()
{
// get the view
$this->view =& $this->getView("icalevent", "html");
$cid = JRequest::getVar('cid', array(0));
JArrayHelper::toInteger($cid);
if (is_array($cid) && count($cid) > 0) {
$id = $cid[0];
} else {
$id = 0;
}
// front end passes the id as evid
if ($id == 0) {
$id = JRequest::getInt("evid", 0);
}
if (!JEVHelper::isEventCreator()) {
JError::raiseError(403, JText::_('ALERTNOTAUTH'));
}
$repeatId = 0;
$db = JFactory::getDBO();
// iCal agid uses GUID or UUID as identifier
if ($id > 0) {
if ($repeatId == 0) {
// this version gives us a repeat not an event so
//$row = $this->queryModel->getEventById($id, true, "icaldb");
$vevent = $this->dataModel->queryModel->getVEventById($id);
if (!$vevent) {
$Itemid = JRequest::getInt("Itemid");
JFactory::getApplication()->redirect(JRoute::_("index.php?option=" . JEV_COM_COMPONENT . "&Itemid={$Itemid}", false), JText::_("JEV_SORRY_UPDATED"));
}
$row = new jIcalEventDB($vevent);
$row->fixDtstart();
} else {
$row = $this->queryModel->listEventsById($repeatId, true, "icaldb");
}
if (!JEVHelper::canEditEvent($row)) {
JError::raiseError(403, JText::_('ALERTNOTAUTH'));
}
} else {
$vevent = new iCalEvent($db);
$vevent->set("freq", "DAILY");
$vevent->set("description", "");
$vevent->set("summary", "");
list($year, $month, $day) = JEVHelper::getYMD();
$params = JComponentHelper::getParams(JEV_COM_COMPONENT);
$defaultstarttime = $params->get("defaultstarttime", "08:00");
$defaultendtime = $params->get("defaultendtime", "17:00");
list($starthour, $startmin) = explode(":", $defaultstarttime);
list($endhour, $endmin) = explode(":", $defaultendtime);
$vevent->set("dtstart", JevDate::mktime($starthour, $startmin, 0, $month, $day, $year));
$vevent->set("dtend", JevDate::mktime($endhour, $endmin, 0, $month, $day, $year));
$row = new jIcalEventDB($vevent);
// TODO - move this to class!!
// populate with meaningful initial values
$row->starttime($defaultstarttime);
$row->endtime($defaultendtime);
}
/*
$db =& JFactory::getDBO();
// get list of groups
$query = "SELECT id AS value, name AS text"
. "\n FROM #__groups"
. "\n ORDER BY id" ;
$db->setQuery( $query );
$groups = $db->loadObjectList();
// build the html select list
$glist = JHTML::_('select.genericlist', $groups, 'access', 'class="inputbox" size="1"', 'value', 'text', intval( $row->access() ) );
*/
$glist = JEventsHTML::buildAccessSelect(intval($row->access()), 'class="inputbox" size="1"');
// get all the raw native calendars
$nativeCals = $this->dataModel->queryModel->getNativeIcalendars();
// Strip this list down based on user permissions
$jevuser =& JEVHelper::getAuthorisedUser();
if ($jevuser && $jevuser->calendars != "" && $jevuser->calendars != "all") {
$cals = array_keys($nativeCals);
$allowedcals = explode("|", $jevuser->calendars);
foreach ($cals as $calid) {
if (!in_array($calid, $allowedcals)) {
unset($nativeCals[$calid]);
}
}
}
// Are we allowed to edit events within a URL based iCal
$params = JComponentHelper::getParams(JEV_COM_COMPONENT);
if ($params->get("allowedit", 0) && $row->icsid() > 0) {
$calsql = 'SELECT * FROM #__jevents_icsfile WHERE ics_id=' . intval($row->icsid());
$db->setQuery($calsql);
$cal = $db->loadObject();
if ($cal && $cal->icaltype == 0) {
$nativeCals[$cal->ics_id] = $cal;
$this->view->assign("offerlock", 1);
}
}
$excats = "0";
if ($jevuser && $jevuser->categories != "" && $jevuser->categories != "all") {
// Find which categories to exclude
if (JVersion::isCompatible("1.6.0")) {
$catsql = 'SELECT id FROM #__categories WHERE id NOT IN (' . str_replace("|", ",", $jevuser->categories) . ') AND extension="com_jevents"';
} else {
//.........这里部分代码省略.........
示例2: edit
function edit($key = NULL, $urlVar = NULL)
{
// get the view
$this->view = $this->getView("icalrepeat", "html");
// Get/Create the model
if ($model = $this->getModel("icalevent", "icaleventsModel")) {
// Push the model into the view (as default)
$this->view->setModel($model, true);
}
$db = JFactory::getDBO();
$cid = JRequest::getVar('cid', array(0));
JArrayHelper::toInteger($cid);
if (is_array($cid) && count($cid) > 0) {
$id = $cid[0];
} else {
$id = $cid;
}
if (!JEVHelper::isEventCreator()) {
throw new Exception(JText::_('ALERTNOTAUTH'), 403);
return false;
}
// front end passes the id as evid
if ($id == 0) {
$id = JRequest::getInt("evid", 0);
}
$db = JFactory::getDBO();
$query = "SELECT rpt.eventid" . "\n FROM (#__jevents_vevent as ev, #__jevents_icsfile as icsf)" . "\n LEFT JOIN #__jevents_repetition as rpt ON rpt.eventid = ev.ev_id" . "\n LEFT JOIN #__jevents_vevdetail as det ON det.evdet_id = rpt.eventdetail_id" . "\n LEFT JOIN #__jevents_rrule as rr ON rr.eventid = ev.ev_id" . "\n WHERE rpt.rp_id=" . $id . "\n AND icsf.ics_id=ev.icsid AND icsf.state=1";
$db->setQuery($query);
$ev_id = $db->loadResult();
if ($ev_id == 0 || $id == 0) {
$this->setRedirect('index.php?option=' . JEV_COM_COMPONENT . '&task=icalrepeat.list&cid[]=' . $ev_id, "ICal repeat does not exist");
$this->redirect();
}
$repeatId = $id;
$row = $this->queryModel->listEventsById($repeatId, true, "icaldb");
if (!JEVHelper::canEditEvent($row)) {
throw new Exception(JText::_('ALERTNOTAUTH'), 403);
return false;
}
/*
$db = JFactory::getDBO();
// get list of groups
$query = "SELECT id AS value, name AS text"
. "\n FROM #__groups"
. "\n ORDER BY id" ;
$db->setQuery( $query );
$groups = $db->loadObjectList();
// build the html select list
$glist = JHTML::_('select.genericlist', $groups, 'access', 'class="inputbox" size="1"',
'value', 'text', intval( $row->access() ) );
*/
$glist = JEventsHTML::buildAccessSelect(intval($row->access()), 'class="inputbox" size="1"');
// For repeats don't offer choice of ical or category
// get all the raw native calendars
$nativeCals = $this->dataModel->queryModel->getNativeIcalendars();
$icsid = $row->icsid() > 0 ? $row->icsid() : current($nativeCals)->ics_id;
$clist = '<input type="hidden" name="ics_id" value="' . $icsid . '" />';
$this->view->assign('clistChoice', false);
$this->view->assign('defaultCat', 0);
// Set the layout
$this->view->setLayout('edit');
$this->view->assign('ev_id', $ev_id);
$this->view->assign('rp_id', $repeatId);
$this->view->assign('row', $row);
$this->view->assign('nativeCals', $nativeCals);
$this->view->assign('clist', $clist);
$this->view->assign('repeatId', $repeatId);
$this->view->assign('glist', $glist);
$this->view->assignRef('dataModel', $this->dataModel);
$this->view->assign('editCopy', false);
// only those who can publish globally can set priority field
if (JEVHelper::isEventPublisher(true)) {
$list = array();
for ($i = 0; $i < 10; $i++) {
$list[] = JHTML::_('select.option', $i, $i, 'val', 'text');
}
$priorities = JHTML::_('select.genericlist', $list, 'priority', "", 'val', 'text', $row->priority());
$this->view->assign('setPriority', true);
$this->view->assign('priority', $priorities);
} else {
$this->view->assign('setPriority', false);
}
// for Admin interface only
$this->view->assign('with_unpublished_cat', JFactory::getApplication()->isAdmin());
$this->view->display();
}
示例3: submitbutton
} else {
$filemessage = JText::_('FROM_FILE');
}
} else {
$id = 0;
$catid = 0;
$access = 0;
$srcURL = "";
$filename = "";
$overlaps = 0;
$label = "";
$icaltype = 2;
$filemessage = JText::_('FROM_FILE');
}
// build the html select list
$glist = JEventsHTML::buildAccessSelect($access, 'class="inputbox" size="1"', "", "access");
$disabled = "";
echo JEventsHTML::buildScriptTag('start');
// leave this as submit button since our submit buttons use the old functional form
?>
function submitbutton(pressbutton) {
if (pressbutton.substr(0, 10) == 'icals.list') {
submitform( pressbutton );
return;
}
var form = document.adminForm;
if (form.catid.value == "0"){
alert( "<?php
echo html_entity_decode(JText::_('JEV_E_WARNCAT'));
?>