Beispiel #1
0
         if (!$publisher->getHandler('item')->delete($itemObj)) {
             redirect_header("item.php", 2, _AM_PUBLISHER_ITEM_DELETE_ERROR . publisher_formatErrors($itemObj->getErrors()));
             exit;
         }
         redirect_header("item.php", 2, sprintf(_AM_PUBLISHER_ITEMISDELETED, $itemObj->title()));
         exit;
     } else {
         xoops_cp_header();
         xoops_confirm(array('op' => 'del', 'itemid' => $itemObj->itemid(), 'confirm' => 1, 'name' => $itemObj->title()), 'item.php', _AM_PUBLISHER_DELETETHISITEM . " <br />'" . $itemObj->title() . "'. <br /> <br />", _AM_PUBLISHER_DELETE);
         xoops_cp_footer();
     }
     exit;
     break;
 case "default":
 default:
     publisher_cpHeader();
     //publisher_adminMenu(2, _AM_PUBLISHER_ITEMS);
     xoops_load('XoopsPageNav');
     echo "<br />\n";
     echo "<form><div style=\"margin-bottom: 12px;\">";
     echo "<input type='button' name='button' onclick=\"location='item.php?op=mod'\" value='" . _AM_PUBLISHER_CREATEITEM . "'>&nbsp;&nbsp;";
     echo "</div></form>";
     $orderBy = 'datesub';
     $ascOrDesc = 'DESC';
     // Display Submited articles
     publisher_openCollapsableBar('submiteditemstable', 'submiteditemsicon', _AM_PUBLISHER_SUBMISSIONSMNGMT, _AM_PUBLISHER_SUBMITTED_EXP);
     // Get the total number of submitted ITEM
     $totalitems = $publisher->getHandler('item')->getItemsCount(-1, array(_PUBLISHER_STATUS_SUBMITTED));
     $itemsObj = $publisher->getHandler('item')->getAllSubmitted($publisher->getConfig('idxcat_perpage'), $submittedstartitem, -1, $orderBy, $ascOrDesc);
     $totalItemsOnPage = count($itemsObj);
     echo "<table width='100%' cellspacing=1 cellpadding=3 border=0 class = outer>";
Beispiel #2
0
function search()
{
    $publisher = PublisherPublisher::getInstance();
    global $oAdminButton, $hMime, $limit, $start, $imagearray, $aSearchBy, $aOrderBy, $aLimitBy, $aSortBy;
    if (isset($_POST['deleteMimes'])) {
        $aMimes = $_POST['mimes'];
        $crit = new Criteria('mime_id', "(" . implode($aMimes, ',') . ")", "IN");
        if ($publisher->getHandler('mimetype')->deleteAll($crit)) {
            header("Location: " . PUBLISHER_ADMIN_URL . "/mimetypes.php?limit={$limit}&start={$start}");
        } else {
            redirect_header(PUBLISHER_ADMIN_URL . "/mimetypes.php?limit={$limit}&start={$start}", 3, _AM_PUBLISHER_MESSAGE_DELETE_MIME_ERROR);
        }
    }
    if (isset($_POST['add_mime'])) {
        header("Location: " . PUBLISHER_ADMIN_URL . "/mimetypes.php?op=add&start={$start}&limit={$limit}");
        exit;
    }
    if (isset($_REQUEST['order'])) {
        $order = $_REQUEST['order'];
    } else {
        $order = "ASC";
    }
    if (isset($_REQUEST['sort'])) {
        $sort = $_REQUEST['sort'];
    } else {
        $sort = "mime_name";
    }
    publisher_cpHeader();
    //publisher_adminMenu(4, _AM_PUBLISHER_MIMETYPES . " > " . _AM_PUBLISHER_BUTTON_SEARCH);
    publisher_openCollapsableBar('mimemsearchtable', 'mimesearchicon', _AM_PUBLISHER_MIME_SEARCH);
    if (!isset($_REQUEST['mime_search'])) {
        echo "<form action='mimetypes.php?op=search' method='post'>";
        echo "<table width='100%' cellspacing='1' class='outer'>";
        echo "<tr><th colspan='2'>" . _AM_PUBLISHER_TEXT_SEARCH_MIME . "</th></tr>";
        echo "<tr><td class='head' width='20%'>" . _AM_PUBLISHER_TEXT_SEARCH_BY . "</td>\r\n        <td class='even'>\r\n        <select name='search_by'>";
        foreach ($aSortBy as $value => $text) {
            echo "<option value='{$value}'>{$text}</option>";
        }
        echo "</select>\r\n        </td>\r\n        </tr>";
        echo "<tr><td class='head'>" . _AM_PUBLISHER_TEXT_SEARCH_TEXT . "</td>\r\n        <td class='even'>\r\n        <input type='text' name='search_text' id='search_text' value='' />\r\n        </td>\r\n        </tr>";
        echo "<tr class='foot'>\r\n        <td colspan='2'>\r\n        <input type='submit' name='mime_search' id='mime_search' value='" . _AM_PUBLISHER_BUTTON_SEARCH . "' />\r\n        </td>\r\n        </tr>";
        echo "</table></form>";
    } else {
        $search_field = $_REQUEST['search_by'];
        $search_text = $_REQUEST['search_text'];
        $crit = new Criteria($search_field, "%{$search_text}%", 'LIKE');
        $crit->setSort($sort);
        $crit->setOrder($order);
        $crit->setLimit($limit);
        $crit->setStart($start);
        $mime_count = $publisher->getHandler('mimetype')->getCount($crit);
        $mimetypes = $publisher->getHandler('mimetype')->getObjects($crit);
        $nav = new XoopsPageNav($mime_count, $limit, $start, 'start', "op=search&amp;limit={$limit}&amp;order={$order}&amp;sort={$sort}&amp;mime_search=1&amp;search_by={$search_field}&amp;search_text={$search_text}");
        // Display results
        echo '<script type="text/javascript" src="' . PUBLISHER_URL . '/include/functions.js"></script>';
        echo "<table width='100%' cellspacing='1' class='outer'>";
        echo "<tr><td colspan='6' align='right'>";
        echo "<form action='" . PUBLISHER_ADMIN_URL . "/mimetypes.php?op=search' style='margin:0; padding:0;' method='post'>";
        echo "<table>";
        echo "<tr>";
        echo "<td align='right'>" . _AM_PUBLISHER_TEXT_SEARCH_BY . "</td>";
        echo "<td align='left'><select name='search_by'>";
        foreach ($aSearchBy as $value => $text) {
            $search_field == $value ? $selected = "selected='selected'" : ($selected = '');
            echo "<option value='{$value}' {$selected}>{$text}</option>";
        }
        echo "</select></td>";
        echo "<td align='right'>" . _AM_PUBLISHER_TEXT_SEARCH_TEXT . "</td>";
        echo "<td align='left'><input type='text' name='search_text' id='search_text' value='{$search_text}' /></td>";
        echo "<td><input type='submit' name='mime_search' id='mime_search' value='" . _AM_PUBLISHER_BUTTON_SEARCH . "' /></td>";
        echo "</tr></table></form></td></tr>";
        echo "<tr><td colspan='6'>";
        echo "<form action='" . PUBLISHER_ADMIN_URL . "/mimetypes.php?op=search' style='margin:0; padding:0;' method='post'>";
        echo "<table width='100%'>";
        echo "<tr><td align='right'>" . _AM_PUBLISHER_TEXT_SORT_BY . "\r\n        <select name='sort'>";
        foreach ($aSortBy as $value => $text) {
            $sort == $value ? $selected = "selected='selected'" : ($selected = '');
            echo "<option value='{$value}' {$selected}>{$text}</option>";
        }
        echo "</select>\r\n        &nbsp;&nbsp;&nbsp;\r\n        " . _AM_PUBLISHER_TEXT_ORDER_BY . "\r\n        <select name='order'>";
        foreach ($aOrderBy as $value => $text) {
            $order == $value ? $selected = "selected='selected'" : ($selected = '');
            echo "<option value='{$value}' {$selected}>{$text}</option>";
        }
        echo "</select>\r\n        &nbsp;&nbsp;&nbsp;\r\n        " . _AM_PUBLISHER_TEXT_NUMBER_PER_PAGE . "\r\n        <select name='limit'>";
        foreach ($aLimitBy as $value => $text) {
            $limit == $value ? $selected = "selected='selected'" : ($selected = '');
            echo "<option value='{$value}' {$selected}>{$text}</option>";
        }
        echo "</select>\r\n        <input type='submit' name='mime_sort' id='mime_sort' value='" . _AM_PUBLISHER_BUTTON_SUBMIT . "' />\r\n        <input type='hidden' name='mime_search' id='mime_search' value='1' />\r\n        <input type='hidden' name='search_by' id='search_by' value='{$search_field}' />\r\n        <input type='hidden' name='search_text' id='search_text' value='{$search_text}' />\r\n        </td>\r\n        </tr>";
        echo "</table>";
        echo "</td></tr>";
        if (count($mimetypes) > 0) {
            echo "<tr><th colspan='6'>" . _AM_PUBLISHER_TEXT_SEARCH_MIME . "</th></tr>";
            echo "<tr class='head'>\r\n            <td>" . _AM_PUBLISHER_MIME_ID . "</td>\r\n            <td>" . _AM_PUBLISHER_MIME_NAME . "</td>\r\n            <td>" . _AM_PUBLISHER_MIME_EXT . "</td>\r\n            <td>" . _AM_PUBLISHER_MIME_ADMIN . "</td>\r\n            <td>" . _AM_PUBLISHER_MIME_USER . "</td>\r\n            <td>" . _AM_PUBLISHER_MINDEX_ACTION . "</td>\r\n            </tr>";
            foreach ($mimetypes as $mime) {
                echo "<tr class='even'>\r\n                <td><input type='checkbox' name='mimes[]' value='" . $mime->getVar('mime_id') . "' />" . $mime->getVar('mime_id') . "</td>\r\n                <td>" . $mime->getVar('mime_name') . "</td>\r\n                <td>" . $mime->getVar('mime_ext') . "</td>\r\n                <td>\r\n                <a href='" . PUBLISHER_ADMIN_URL . "/mimetypes.php?op=updateMimeValue&amp;id=" . $mime->getVar('mime_id') . "&amp;mime_admin=" . $mime->getVar('mime_admin') . "&amp;limit=" . $limit . "&amp;start=" . $start . "'>\r\n                " . ($mime->getVar('mime_admin') ? $imagearray['online'] : $imagearray['offline']) . "</a>\r\n                </td>\r\n                <td>\r\n                <a href='" . PUBLISHER_ADMIN_URL . "/mimetypes.php?op=updateMimeValue&amp;id=" . $mime->getVar('mime_id') . "&amp;mime_user="******"&amp;limit=" . $limit . "&amp;start=" . $start . "'>\r\n                " . ($mime->getVar('mime_user') ? $imagearray['online'] : $imagearray['offline']) . "</a>\r\n                </td>\r\n                <td>\r\n                <a href='" . PUBLISHER_ADMIN_URL . "/mimetypes.php?op=edit&amp;id=" . $mime->getVar('mime_id') . "&amp;limit=" . $limit . "&amp;start=" . $start . "'>" . $imagearray['editimg'] . "</a>\r\n                <a href='" . PUBLISHER_ADMIN_URL . "/mimetypes.php?op=delete&amp;id=" . $mime->getVar('mime_id') . "&amp;limit=" . $limit . "&amp;start=" . $start . "'>" . $imagearray['deleteimg'] . "</a>\r\n                </td>\r\n                </tr>";
            }
            echo "<tr class='foot'>\r\n            <td colspan='6' valign='top'>\r\n            <a href='http://www.filext.com' style='float: right' target='_blank'>" . _AM_PUBLISHER_MIME_FINDMIMETYPE . "</a>\r\n            <input type='checkbox' name='checkAllMimes' value='0' onclick='selectAll(this.form,\"mimes[]\",this.checked);' />\r\n            <input type='submit' name='deleteMimes' id='deleteMimes' value='" . _AM_PUBLISHER_BUTTON_DELETE . "' />\r\n            <input type='submit' name='add_mime' id='add_mime' value='" . _AM_PUBLISHER_MIME_CREATEF . "' class='formButton' />\r\n            </td>\r\n            </tr>";
        } else {
            echo "<tr><th>" . _AM_PUBLISHER_TEXT_SEARCH_MIME . "</th></tr>";
            echo "<tr class='even'>\r\n            <td>" . _AM_PUBLISHER_TEXT_NO_RECORDS . "</td>\r\n            </tr>";
        }
        echo "</table>";
        echo "<div id='pagenav'>" . $nav->renderNav() . "</div>";
    }
    publisher_closeCollapsableBar('mimesearchtable', 'mimesearchicon');
    xoops_cp_footer();
}