本文整理汇总了PHP中Jfactory类的典型用法代码示例。如果您正苦于以下问题:PHP Jfactory类的具体用法?PHP Jfactory怎么用?PHP Jfactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Jfactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
function display($tpl = null)
{
// Assign data to the view
$this->events = $this->get('Events');
$this->protocolReminders = $this->get('ProtocolReminders');
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode('<br />', $errors));
return false;
}
$document = JFactory::getDocument();
$this->mapJS($document);
$totalEvents = $this->get('NumEvents');
$apiParams = json_encode($this->get('ApiParams'));
$userID = Jfactory::getUser()->id;
$canRecordAttendance = SWG_EventsController::canRecordAttendance() ? 'true' : 'false';
$document->addScript('/components/com_swg_events/views/eventlisting/script/eventlisting.js');
$document->addScriptDeclaration(<<<MAP
window.addEvent('domready', function()
{
\tregisterMapLinks();
\tdocument.addEvent("scroll",scrolled);
\ttotalEvents = {$totalEvents};
\tapiParams = {$apiParams};
\tcanRecordAttendance = {$canRecordAttendance};
\tuserID = {$userID};
});
MAP
);
// Display the view
parent::display($tpl);
}
示例2: save
/**
* save the posted form data.
*
*/
function save()
{
$mainframe = Jfactory::getApplication();
$model = $this->getModel('redform');
$result = $model->apisaveform();
$referer = JRequest::getVar('referer');
if (!$result) {
if (!JRequest::getBool('ALREADY_ENTERED')) {
$msg = JText::_('COM_REDFORM_Sorry_there_was_a_problem_with_your_submission') . ': ' . $model->getError();
}
$this->setRedirect($referer, $msg, 'error');
$this->redirect();
}
if ($url = $model->hasActivePayment($result->submit_key)) {
$url = 'index.php?option=com_redform&controller=payment&task=select&key=' . $result->submit_key;
$this->setRedirect($url);
$this->redirect();
}
if ($url = $model->getRedirect()) {
$this->setRedirect($url);
$this->redirect();
} else {
echo $model->getNotificationText();
}
}
示例3: __construct
public function __construct($id = null)
{
if ($id) {
$this->setId($id);
}
$this->_db = Jfactory::getDbo();
}
示例4: save
function save(&$element, $forceBackend = false)
{
$app = Jfactory::getApplication();
if ($app->isAdmin() || $forceBackend) {
return $this->saveBackend($element);
}
return $this->saveFrontend($element);
}
示例5: onContentSearch
/**
* Example Search method
*
* The sql must return the following fields that are used in a common display
* routine:
- title;
- href: link associated with the title;
- browsernav if 1, link opens in a new window, otherwise in the same window;
- section in parenthesis below the title;
- text;
- created;
* @param string Target search string
* @param string matching option, exact|any|all
* @param string ordering option, newest|oldest|popular|alpha|category
* @param mixed An array if the search it to be restricted to areas, null if search all
*
* @return array Search results
*/
public function onContentSearch($text, $phrase = '', $ordering = '', $areas = null)
{
$result = array();
// jelenleg semmilyen paramétert nem veszek figyelembe és hozzáférés ellenörzés sincs.
$db = Jfactory::getDBO();
// témakorok
$db->setQuery('select t.megnevezes as title,
t.id,
"2" as browsernav,
"' . JText::_('TEMAKOROK') . '" as section,
"" as `text`,
t.letrehozva as created
from #__temakorok t
where t.megnevezes like "%' . $text . '%"
order by t.id DESC');
$res = $db->loadObjectList();
foreach ($res as $res1) {
$res1->href = 'index.php?option=com_szavazasok&view=szavazasoklist&temakor=' . $res1->id;
$result[] = $res1;
}
// szavazások
$db->setQuery('select sz.megnevezes as title,
sz.id,
"2" as browsernav,
"' . JText::_('SZAVAZASOK') . '" as section,
"" as `text`,
sz.letrehozva as created
from #__szavazasok sz
where sz.megnevezes like "%' . $text . '%"
order by sz.id DESC');
$res = $db->loadObjectList();
foreach ($res as $res1) {
$res1->href = 'index.php?option=com_alternativak&view=alternativaklist&szavazas=' . $res1->id;
$result[] = $res1;
}
// alternativák
$db->setQuery('select sz.megnevezes as title,
sz.id,
"2" as browsernav,
"' . JText::_('ALTERNATIVAK') . '" as section,
"" as `text`,
sz.letrehozva as created
from #__szavazasok sz, #__alternativak a
where a.szavazas_id = sz.id and a.megnevezes like "%' . $text . '%"
order by sz.id DESC');
$res = $db->loadObjectList();
foreach ($res as $res1) {
$res1->href = 'index.php?option=com_alternativak&view=alternativaklist&szavazas=' . $res1->id;
$result[] = $res1;
}
return $result;
}
示例6: __construct
public function __construct($params)
{
$this->_params = $params;
$this->_db = Jfactory::getDBO();
if (JRequest::getCmd('option') == 'com_joomleague') {
$p = JRequest::getInt('p', $params->get('default_project_id'));
} else {
$p = $params->get('default_project_id');
}
$this->_project_id = intval($p);
$this->_project = $this->getProject();
$this->_round_id = JRequest::getInt('r');
$this->_division_id = JRequest::getInt('division', 0);
$this->_team_id = JRequest::getInt('tid', 0);
}
示例7: eventAccess
/**
* Function to return event access (access levels, approval and event access status)
*
* @access public static
* @param $id - id of the event
* @return list array of access levels, approval and event access status
*
* @since 3.4.0
*/
public static function eventAccess($id = null)
{
// Preparing connection to db
$db = Jfactory::getDbo();
// Preparing the query
$query = $db->getQuery(true);
$query->select('e.state AS evtState, e.approval AS evtApproval, e.access AS evtAccess')->from($db->qn('#__icagenda_events') . ' AS e')->where($db->qn('e.id') . ' = ' . $db->q($id));
$query->select('v.title AS accessName')->join('LEFT', $db->quoteName('#__viewlevels') . ' AS v ON v.id = e.access');
$db->setQuery($query);
$eventAccess = $db->loadObject();
if ($eventAccess) {
return $eventAccess;
} else {
return false;
}
}
示例8: _lookupUserLogin
/**
* Retrieve the Twitter connection details for the current user
* @return array
*/
function _lookupUserLogin()
{
global $mainframe;
$user =& Jfactory::getUser();
if ($user->id) {
// make sure there is a logged in user
$btuser =& JTable::getInstance('btuser');
$data = $this->getUser($user->id);
$key = str_rot13(strrev($user->username));
$crypt = new JSimpleCrypt($key);
$password = $crypt->decrypt($data->password);
return array('username' => $data->username, 'password' => $password);
} else {
return array('username' => '', 'password' => '');
}
}
示例9: array
/**
* Returns a reference to the global User object, only creating it if it
* doesn't already exist.
*
* This method must be invoked as:
* <pre> $user =& JUser::getInstance($id);</pre>
*
* @access public
* @param int $id The user to load - Can be an integer or string - If string, it is converted to ID automatically.
* @return JUser The User object.
* @since 1.5
*/
function &getInstance($id = 0)
{
static $instances;
if (!isset($instances)) {
$instances = array();
}
// Find the user id
if (!$id) {
$user =& Jfactory::getUser();
$id = $user->get('id');
}
if (empty($instances[$id])) {
$inst = new UserAcl($id);
$instances[$id] = $inst;
}
return $instances[$id];
}
示例10: makeDefault
function makeDefault()
{
$mainframe = Jfactory::getApplication();
/* Load the view object */
$view = $this->getView('shoppergroup', 'html');
$model = VmModel::getModel('shoppergroup');
$msgtype = '';
$cids = JRequest::getVar('virtuemart_shoppergroup_id', array());
if ($model->makeDefault((int) $cids[0])) {
$msg = JText::_('COM_VIRTUEMART_SET_TO_DEFAULT_SUCCESSFULLY');
} else {
$msg = '';
// $msg = JText::_('COM_VIRTUEMART_SET_TO_DEFAULT_ERROR');
$msgtype = 'error';
}
$mainframe->redirect('index.php?option=com_virtuemart&view=shoppergroup', $msg, $msgtype);
}
示例11: getItems
/**
* rekord sorozat beolvasása az adatbázisból
* @JRequest filter, order, limit, limitstart
* @return array of records
*/
public function getItems($state)
{
$db = Jfactory::getDBO();
$query = $this->getListQuery($state);
$limit = 100000;
$limitstart = $state->limitstart;
if ($limit == '') {
$limit = 20;
}
if ($limit == 0) {
$limit = 20;
}
if ($limitstart == '') {
$limitstart = 0;
}
$db->setQuery($query, $limitstart, $limit);
return $db->loadObjectList();
}
示例12: createClone
/**
* Clone a product
*
* @author Max Milbers
*/
public function createClone()
{
$mainframe = Jfactory::getApplication();
/* Load the view object */
$view = $this->getView('custom', 'html');
$model = tmsModel::getModel('custom');
$msgtype = '';
$cids = vRequest::getInt($this->_cidName, vRequest::getInt('tsmart_custom_id'));
foreach ($cids as $custom_id) {
if ($model->createClone($custom_id)) {
$msg = tsmText::_('com_tsmart_CUSTOM_CLONED_SUCCESSFULLY');
} else {
$msg = tsmText::_('com_tsmart_CUSTOM_NOT_CLONED_SUCCESSFULLY') . ' : ' . $custom_id;
$msgtype = 'error';
}
}
$mainframe->redirect('index.php?option=com_tsmart&view=custom', $msg, $msgtype);
}
示例13: _checkVersionTable
/**
* make sure the version table has the proper structure (1.0 import !)
* if not, update it
*/
function _checkVersionTable()
{
$db = Jfactory::getDBO();
$res = $db->getTableFields('#__joomleague_version');
$cols = array_keys(reset($res));
if (!in_array('major', $cols)) {
$query = ' ALTER TABLE #__joomleague_version ADD `major` INT NOT NULL ,
ADD `minor` INT NOT NULL ,
ADD `build` INT NOT NULL ,
ADD `count` INT NOT NULL ,
ADD `revision` VARCHAR(128) NOT NULL ,
ADD `file` VARCHAR(255) NOT NULL';
$db->setQuery($query);
if (!$db->query()) {
echo JText::_('Failed updating version table');
}
}
}
示例14: getItems
/**
* rekord sorozat beolvasása az adatbázisból
* @JRequest filter, order, limit, limitstart
* @return array of records
*/
public function getItems($state)
{
$db = Jfactory::getDBO();
$query = $this->getListQuery($state);
$limit = JRequest::getvar('limit', 20);
$limitstart = JRequest::getvar('limitstart', 0);
if ($limit == '') {
$limit = 20;
}
if ($limit == 0) {
$limit = 20;
}
if ($limitstart == '') {
$limitstart = 0;
}
$db->setQuery($query, $limitstart, $limit);
return $db->loadObjectList();
}
示例15: CloneShipment
/**
* Clone a shipment
*
* @author Valérie Isaksen
*/
public function CloneShipment()
{
$mainframe = Jfactory::getApplication();
/* Load the view object */
$view = $this->getView('shipmentmethod', 'html');
$model = VmModel::getModel('shipmentmethod');
$msgtype = '';
$cids = vRequest::getVar($this->_cidName, vRequest::getInt('virtuemart_shipment_id'));
foreach ($cids as $cid) {
if ($model->createClone($cid)) {
$msg = vmText::_('COM_VIRTUEMART_SHIPMENT_CLONED_SUCCESSFULLY');
} else {
$msg = vmText::_('COM_VIRTUEMART_SHIPMENT_NOT_CLONED_SUCCESSFULLY');
$msgtype = 'error';
}
}
$mainframe->redirect('index.php?option=com_virtuemart&view=shipmentmethod', $msg, $msgtype);
}