コード例 #1
0
ファイル: jtip.class.php プロジェクト: joomux/jTips
 function loadByParams($params = array(), $limit = FALSE, $offset = FALSE)
 {
     global $database;
     $extra_clause = "";
     if ($limit !== FALSE and !empty($limit)) {
         $extra_clause .= " LIMIT {$limit}";
     }
     if ($offset !== FALSE and !empty($offset)) {
         $extra_clause .= " OFFSET {$offset}";
     }
     $query = "SELECT " . $this->_tbl . ".id FROM " . $this->_tbl . " " . buildWhere($params) . " {$extra_clause};";
     jTipsLogger::_log("FULL QUERY: {$query}");
     $database->setQuery($query);
     $database->query();
     if ($database->getNumRows() > 1) {
         $jObjs = array();
         $list = (array) $database->loadResultArray();
         foreach ($list as $id) {
             $jObj = new jTip($database);
             $jObj->load($id);
             array_push($jObjs, $jObj);
         }
         return $jObjs;
     } else {
         if ($database->getNumRows() == 1) {
             $this->load($database->loadResult());
             return $this;
         } else {
             return FALSE;
         }
     }
 }
コード例 #2
0
ファイル: save.php プロジェクト: joomux/jTips
 * Author: Jeremy Roberts
 * Company: jTips
 * Website: www.jtips.com.au
 * Licence: Commercial. May not be copied, modified or redistributed
 */
defined('_JEXEC') or defined('_VALID_MOS') or die('Direct Access to this location is not allowed.');
require_once 'components/com_jtips/classes/jtip.class.php';
global $database, $jTips;
jTipsSpoofCheck();
//jTipsDebug($_REQUEST);
$game_ids = jTipsGetParam($_REQUEST, 'game_id', array());
//jTipsDebug($game_ids);
foreach ($game_ids as $index => $gid) {
    $jTip = new jTip($database);
    if (!empty($_REQUEST['id'][$index])) {
        $jTip->load($_REQUEST['id'][$index]);
    }
    $game_index = "g{$gid}";
    $jTip->tip_id = jTipsGetParam($_REQUEST[$game_index], 'tip_id');
    $jTip->home_score = jTipsGetParam($_REQUEST[$game_index], 'home_score');
    $jTip->away_score = jTipsGetParam($_REQUEST[$game_index], 'away_score');
    $jTip->margin = jTipsGetParam($_REQUEST[$game_index], 'margin');
    $jTip->bonus_id = jTipsGetParam($_REQUEST[$game_index], 'bonus_id');
    $jTip->game_id = $gid;
    $jTip->user_id = jTipsGetParam($_REQUEST, 'user_id');
    if (!empty($jTip->user_id)) {
        jTipsLogger::_log("ADMIN: saving tips. Tip_id = " . $jTip->tip_id);
        $jTip->save();
    }
}
mosRedirect('index2.php?option=com_jtips&task=list&module=Tips', 'Tips Saved');
コード例 #3
0
ファイル: edit.php プロジェクト: joomux/jTips
 */
defined('_JEXEC') or defined('_VALID_MOS') or die('Direct Access to this location is not allowed.');
require_once 'components/com_jtips/classes/jtip.class.php';
require_once 'components/com_jtips/classes/jseason.class.php';
require_once 'components/com_jtips/classes/jround.class.php';
require_once 'components/com_jtips/modules/Tips/edit.tmpl.php';
global $database;
jTipsSpoofCheck();
$tpl = new EditMode();
$tpl->formData = array('title' => 'Tips Editor');
$ids = jTipsGetParam($_REQUEST, 'cid', array());
//Do we have an existing set of tips?
$id = array_shift($ids);
if ($id) {
    $jTip = new jTip($database);
    $jTip->load($id);
    $jTip->fillInAdditionalFields();
    $season_id = $jTip->season->id;
    $round_id = $jTip->round->id;
    $user_id = $jTip->user->id;
} else {
    $season_id = jTipsGetParam($_REQUEST, 'season_id', false);
    $round_id = jTipsGetParam($_REQUEST, 'round_id', false);
    $user_id = jTipsGetParam($_REQUEST, 'user_id', false);
}
//need to select the season, then the round, then list the games
//get the seasons
$jSeason = new jSeason($database);
$jSeasons = forceArray($jSeason->loadByParams(array()));
//make a set of options for a select list
$season_options = objectsToSelectList($jSeasons, 'name');
コード例 #4
0
ファイル: jgame.class.php プロジェクト: joomux/jTips
 function getTips($user_id)
 {
     global $database;
     $query = "SELECT id FROM #__jtips_tips WHERE game_id = " . $this->id . " AND user_id = " . $user_id . ";";
     $database->setQuery($query);
     $jTip = new jTip($database);
     $jTip->load($database->loadResult());
     return $jTip;
 }