primo commit
This commit is contained in:
80
administrator/components/com_tabulizer/models/rule.php
Normal file
80
administrator/components/com_tabulizer/models/rule.php
Normal file
@ -0,0 +1,80 @@
|
||||
<?php
|
||||
/**
|
||||
* @version 6.2.6 tabulizer $
|
||||
* @package tabulizer
|
||||
* @copyright Copyright © 2011 - All rights reserved.
|
||||
* @license GNU/GPL
|
||||
* @author Dimitrios Mourloukos
|
||||
* @author mail info@alterora.gr
|
||||
* @website www.tabulizer.com
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
// no direct access
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
jimport( 'joomla.application.component.model' );
|
||||
|
||||
TabulizerPath::requireLib('ruleset','admin');
|
||||
|
||||
class tabulizerModelRule extends JModelLegacy {
|
||||
|
||||
var $rule_id = null;
|
||||
var $ruleset_name = null;
|
||||
var $archive_filename = null;
|
||||
var $rule = null;
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
function loadRule($rule_id, $ruleset_name, $archive_file) {
|
||||
$this->rule_id = $rule_id;
|
||||
$this->ruleset_name = $ruleset_name;
|
||||
$this->archive_filename = $archive_file;
|
||||
|
||||
$ruleset = new Ruleset();
|
||||
$this->rule = $ruleset->getRule($this->rule_id, $this->ruleset_name, $this->archive_filename);
|
||||
|
||||
if (!empty($this->rule)) {
|
||||
$this->rule['rule_id'] = $rule_id;
|
||||
$this->rule['ruleset_name'] = $ruleset_name;
|
||||
$this->rule['filename'] = $archive_file;
|
||||
}
|
||||
|
||||
return $this->rule;
|
||||
}
|
||||
|
||||
function getRule() {
|
||||
if (empty($this->rule)) {
|
||||
$this->loadRule($this->rule_id, $this->ruleset_name, $this->archive_filename);
|
||||
}
|
||||
|
||||
return $this->rule;
|
||||
}
|
||||
|
||||
function saveRule($rule, $rule_id, $ruleset_name, $ruleset_file) {
|
||||
$ruleset = new Ruleset();
|
||||
return $ruleset->saveRule($rule, $rule_id, $ruleset_name, $ruleset_file);
|
||||
}
|
||||
|
||||
function deleteRule($rule_ids, $ruleset_name, $ruleset_file) {
|
||||
$ruleset = new Ruleset();
|
||||
return $ruleset->deleteRule($rule_ids, $ruleset_name, $ruleset_file);
|
||||
}
|
||||
|
||||
function getReturnURLs(&$urls) {
|
||||
$jinput = JFactory::getApplication()->input;
|
||||
$option = $jinput->getCmd('option');
|
||||
|
||||
$urls = array();
|
||||
$url = $jinput->getString('archives_return_url','');
|
||||
$urls['archives'] = empty($url)?str_replace('&','&',JRoute::_('index.php?option='.$option.'&task=viewrulesetarchives')):urldecode($url);
|
||||
$url = $jinput->getString('archive_return_url','');
|
||||
$urls['archive'] = empty($url)?str_replace('&','&',JRoute::_('index.php?option='.$option.'&task=viewrulesetarchive&archive_filename='.$this->archive_filename)):urldecode($url);
|
||||
$url = str_replace('&','&',JRoute::_('index.php?option='.$option.'&task=viewruleset&ruleset_name='.urlencode($this->ruleset_name).'&archive_filename='.urlencode($this->archive_filename)));
|
||||
$urls['ruleset'] = $url;
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user