Exemplo n.º 1
0
function editPoll($uid = 0, $option = 'com_poll')
{
    global $database, $my;
    $row = new mosPoll($database);
    // load the row from the db table
    $row->load((int) $uid);
    // fail if checked out not by 'me'
    if ($row->isCheckedOut($my->id)) {
        mosRedirect('index2.php?option=' . $option, 'The poll ' . $row->title . ' is currently being edited by another administrator.');
    }
    $options = array();
    if ($uid) {
        $row->checkout($my->id);
        $query = "SELECT id, text" . "\n FROM #__poll_data" . "\n WHERE pollid = " . (int) $uid . "\n ORDER BY id";
        $database->setQuery($query);
        $options = $database->loadObjectList();
    } else {
        $row->lag = 3600 * 24;
        $row->published = 1;
    }
    // get selected pages
    if ($uid) {
        $query = "SELECT menuid AS value" . "\n FROM #__poll_menu" . "\n WHERE pollid = " . (int) $row->id;
        $database->setQuery($query);
        $lookup = $database->loadObjectList();
    } else {
        $lookup = array(mosHTML::makeOption(0, 'All'));
    }
    // build the html select list
    $lists['select'] = mosAdminMenus::MenuLinks($lookup, 1, 1);
    // build the html select list for published
    $lists['published'] = mosAdminMenus::Published($row);
    HTML_poll::editPoll($row, $options, $lists);
}
Exemplo n.º 2
0
function editPoll($uid = 0, $option = 'com_poll')
{
    global $database, $my, $adminLanguage;
    $row = new mosPoll($database);
    // load the row from the db table
    $row->load($uid);
    // fail if checked out not by 'me'
    if ($row->checked_out && $row->checked_out != $my->id) {
        mosRedirect("index2.php?option=" . $option, $adminLanguage->A_COMP_POLL_THE . " " . $row->title . " " . $adminLanguage->A_COMP_POLL_BEING);
    }
    $options = array();
    if ($uid) {
        $row->checkout($my->id);
        $query = "SELECT id, text FROM #__poll_data" . "\n WHERE pollid='{$uid}'" . "\n ORDER BY id";
        $database->setQuery($query);
        $options = $database->loadObjectList();
    } else {
        $row->lag = 3600 * 24;
    }
    // get selected pages
    if ($uid) {
        $database->setQuery("SELECT menuid AS value FROM #__poll_menu WHERE pollid='{$row->id}'");
        $lookup = $database->loadObjectList();
    } else {
        $lookup = array(mosHTML::makeOption(0, 'All'));
    }
    // build the html select list
    $lists['select'] = mosAdminMenus::MenuLinks($lookup, 1, 1);
    HTML_poll::editPoll($row, $options, $lists);
}
Exemplo n.º 3
0
function editPoll($uid = 0, $option = 'com_poll')
{
    global $database, $my;
    $row = new mosPoll($database);
    // load the row from the db table
    $row->load($uid);
    // fail if checked out not by 'me'
    if ($row->checked_out && $row->checked_out != $my->id) {
        $msg = sprintf(T_('The poll %s is currently being edited by another administrator.'), $row->title);
        mosRedirect('index2.php?option=' . $option, $msg);
    }
    $options = array();
    if ($uid) {
        $row->checkout($my->id);
        $query = "SELECT id, text FROM #__poll_data" . "\n WHERE pollid='{$uid}'" . "\n ORDER BY id";
        $database->setQuery($query);
        $options = $database->loadObjectList();
    } else {
        $row->lag = 3600 * 24;
    }
    // get selected pages
    if ($uid) {
        $database->setQuery("SELECT menuid AS value FROM #__poll_menu WHERE pollid='{$row->id}'");
        $lookup = $database->loadObjectList();
    } else {
        $lookup = array(mosHTML::makeOption(0, 'All'));
    }
    // build the html select list
    $lists['select'] = mosAdminMenus::MenuLinks($lookup, 1, 1);
    HTML_poll::editPoll($row, $options, $lists);
}