本文整理汇总了PHP中JemHelper::generate_events方法的典型用法代码示例。如果您正苦于以下问题:PHP JemHelper::generate_events方法的具体用法?PHP JemHelper::generate_events怎么用?PHP JemHelper::generate_events使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JemHelper
的用法示例。
在下文中一共展示了JemHelper::generate_events方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
//.........这里部分代码省略.........
if ($checkAttachName) {
# attachments, new ones first
$attachments = array();
$attachments = $fileFilter->get('attach', array(), 'array');
$attachments['customname'] = $jinput->post->get('attach-name', array(), 'array');
$attachments['description'] = $jinput->post->get('attach-desc', array(), 'array');
$attachments['access'] = $jinput->post->get('attach-access', array(), 'array');
JEMAttachment::postUpload($attachments, 'event' . $pk);
# and update old ones
$old = array();
$old['id'] = $jinput->post->get('attached-id', array(), 'array');
$old['name'] = $jinput->post->get('attached-name', array(), 'array');
$old['description'] = $jinput->post->get('attached-desc', array(), 'array');
$old['access'] = $jinput->post->get('attached-access', array(), 'array');
foreach ($old['id'] as $k => $id) {
$attach = array();
$attach['id'] = $id;
$attach['name'] = $old['name'][$k];
$attach['description'] = $old['description'][$k];
$attach['access'] = $old['access'][$k];
JEMAttachment::update($attach);
}
}
# Store categories
$cats = $data['cats'];
$db = $this->getDbo();
$query = $db->getQuery(true);
$query->delete($db->quoteName('#__jem_cats_event_relations'));
$query->where('itemid = ' . $pk);
$db->setQuery($query);
$db->execute();
foreach ($cats as $cat) {
$db = $this->getDbo();
$query = $db->getQuery(true);
// Insert columns.
$columns = array('catid', 'itemid');
// Insert values.
$values = array($cat, $pk);
// Prepare the insert query.
$query->insert($db->quoteName('#__jem_cats_event_relations'))->columns($db->quoteName($columns))->values(implode(',', $values));
// Reset the query using our newly populated query object.
$db->setQuery($query);
$db->execute();
}
if ($backend || $hide_othertab == false) {
# check for recurrence
# when part of a recurrence_set it will not perform the generating function
/*
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('id');
$query->from($db->quoteName('#__jem_recurrence'));
$query->where(array('exdate IS NULL','itemid ='.$pk));
$db->setQuery($query);
$recurrence_set = $db->loadResult();
*/
$table->load($pk);
# check recurrence
if ($table->recurrence_group) {
# this event is part of a recurrence-group
#
# check for groupid & groupid_ref (recurrence_table)
# - groupid = $item->recurrence_group
# - groupid_ref = $item->recurrence_group
# - Itemid = $item->id
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select(array('count(id)'));
$query->from('#__jem_recurrence');
$query->where(array('groupid= ' . $table->recurrence_group, 'itemid= ' . $pk, 'groupid = groupid_ref'));
$db->setQuery($query);
$rec_groupset_check = $db->loadResult();
if ($rec_groupset_check == '1') {
$recurrence_set = true;
} else {
$recurrence_set = false;
}
} else {
$recurrence_set = false;
}
## check values, pass check before we continue to generate additional events ##
# - do we have an interval?
# - does the event has a date?
# - is the event part of a recurrenceset?
if ($table->recurrence_interval > 0 && !$table->dates == null && $recurrence_set == null) {
# recurrence_interval is bigger then 0
# we do have a startdate
# the event is not part of a recurrence-set
# we passed the check but now we'll pass some variables to the generating functions
# exdates: the dates filled
# table: the row info
if ($this->state->task == 'apply' || $this->state->task == 'save') {
JemHelper::generate_events($table, $exdates, $holidays);
}
}
}
return true;
}
return false;
}