コード例 #1
0
ファイル: list.php プロジェクト: joomux/jTips
$params = array('order' => array('type' => 'order', 'direction' => $direction, 'by' => $orderby));
//has the season select been used?
if ($season_id = jTipsGetParam($_REQUEST, 'season_id', false)) {
    $params['season_id'] = array('type' => 'join', 'join_table' => '#__jtips_rounds', 'lhs_table' => '#__jtips_comments', 'lhs_key' => 'round_id', 'rhs_table' => '#__jtips_rounds', 'rhs_key' => 'id', 'supplement' => 'AND #__jtips_rounds.season_id = ' . $jComment->_db->Quote($season_id));
}
$jComments = forceArray($jComment->loadByParams($params, $limit, $limitstart));
$pageNav = new mosPageNav($jComment->getCount($params), $limitstart, $limit);
$data = array();
$i = 0;
foreach ($jComments as $comment) {
    //get the comment poster details
    $jTipsUser = new jTipsUser($database);
    $jTipsUser->load($comment->user_id);
    //Which round is it for
    $jRound = new jRound($database);
    $jRound->load($comment->round_id);
    if (strlen($comment->comment) > 100) {
        $suffix = '...';
    } else {
        $suffix = '';
    }
    $data[$comment->id] = array(makeListLink(substr(jTipsStripslashes($comment->comment), 0, 100) . $suffix, $i++), $jTipsUser->getUserField('name'), $jTipsUser->getUserField('username'), $comment->getSeasonName(), $jRound->round, TimeDate::toDisplayDateTime($comment->updated));
}
$jSeason = new jSeason($database);
$jSeasons = forceArray($jSeason->loadByParams());
$options = array(jTipsHTML::makeOption('', $jLang['_ADMIN_USERS_SELECT_SEASON']));
foreach ($jSeasons as $season) {
    $options[] = jTipsHTML::makeOption($season->id, $season->name);
}
$filters = array($jLang['_ADMIN_SEASON_SELECT'] => jTipsHTML::selectList($options, 'season_id', "id='season_id' class='inputbox' onChange='this.form.submit();'", 'value', 'text', jTipsGetParam($_REQUEST, 'season_id', '')));
jTipsAdminDisplay::ListView($formData, $header, $data, $pageNav, 'list', $filters, $jLang['_ADMIN_COMMENTS_INFO']);
コード例 #2
0
ファイル: edit.php プロジェクト: joomux/jTips
//Do we have an existing Season?
$id = array_shift($ids);
if (is_numeric($id)) {
    $jComment->load($id);
}
if (!$jComment->exists()) {
    mosRedirect('index2.php?option=com_jtips&task=list&module=Comments', $jLang['_ADMIN_COMMENT_LOAD_ERROR']);
}
$jTipsUser = new jTipsUser($database);
$jTipsUser->load($jComment->user_id);
$title = $jLang['_ADMIN_DASH_COMMENT_MANAGER'] . ": " . $jLang['_ADMIN_OTHER_EDIT'];
$mainframe->addCustomHeadTag("<script type='text/javascript' src='components/com_jtips/modules/Comments/Comments.js'></script>");
//what seasons are there
$jSeason = new jSeason($database);
$jSeasons = forceArray($jSeason->loadByParams(array()));
$jSeasonOptions = array(jTipsHTML::makeOption('', $jLang['_ADMIN_CONF_NONE']));
jTipsSortArrayObjects($jSeasons, 'name', 'ASC');
foreach ($jSeasons as $season) {
    $jSeasonOptions[] = jTipsHTML::makeOption($season->id, $season->name);
}
//which season is this in?
$jRound = new jRound($database);
$jRound->load($jComment->round_id);
$jRounds = forceArray($jRound->loadByParams(array('season_id' => $jRound->season_id)));
$jRoundOptions = array(jTipsHTML::makeOption('', $jLang['_ADMIN_CONF_NONE']));
jTipsSortArrayObjects($jSeasons, 'name', 'ASC');
foreach ($jRounds as $round) {
    $jRoundOptions[] = jTipsHTML::makeOption($round->id, $round->round);
}
$formData = array('basic' => array('legend' => '_ADMIN_COMM_EDIT_COMMENT', 'fields' => array('id' => array('field' => array('type' => 'hidden', 'attributes' => array('type' => 'hidden', 'name' => 'id', 'id' => 'id', 'value' => $jComment->id))), 'orig_round_id' => array('field' => array('type' => 'hidden', 'attributes' => array('type' => 'hidden', 'name' => 'orig_round_id', 'id' => 'orig_round_id', 'value' => $jComment->round_id))), 'user_id' => array('label' => '_COM_DASH_USER', 'field' => array('type' => 'hidden', 'attributes' => array('type' => 'hidden', 'name' => 'user_id', 'id' => 'user_id', 'value' => $jComment->user_id))), 'user' => array('label' => '_COM_DASH_USER', 'field' => array('type' => 'label', 'attributes' => array('type' => 'label', 'value' => $jTipsUser->getUserField('name') . " (" . $jTipsUser->getUserField('username') . ")"))), 'season_id' => array('label' => '_ADMIN_ROUND_SEASON', 'field' => array('type' => 'select', 'attributes' => array('name' => 'season_id', 'id' => 'season_id', 'class' => 'inputbox', 'onChange' => 'getTheRounds(this);'), 'options' => $jSeasonOptions, 'selected' => $jRound->season_id)), 'round_id' => array('label' => '_ADMIN_ROUND_ROUND', 'field' => array('type' => 'select', 'attributes' => array('name' => 'round_id', 'id' => 'round_id', 'class' => 'inputbox'), 'options' => $jRoundOptions, 'selected' => $jComment->round_id)), 'comment' => array('label' => '_ADMIN_COMM_EDIT_COMMENT', 'field' => array('type' => 'text', 'attributes' => array('size' => 50, 'name' => 'comment', 'id' => 'comment', 'class' => 'inputbox', 'type' => 'text', 'value' => jTipsStripslashes(htmlentities($jComment->comment, ENT_QUOTES))))), 'updatedlabel' => array('label' => '_COM_TIPS_LASTUP', 'field' => array('type' => 'label', 'attributes' => array('type' => 'label', 'value' => TimeDate::toDisplayDateTime($jComment->updated))), 'description' => '_ADMIN_COMMENTS_UDPATED_DESCRIPTION'))));
jTipsAdminDisplay::EditView($title, $formData, 'comments');