";
$form_sp = new XoopsThemeForm(art_constant("AM_SPOTLIGHT"), "formsp", xoops_getenv('PHP_SELF'));
$form_sp->setExtra('enctype="multipart/form-data"');
// Current Spotlight
if ($spotlight_obj->getVar("art_id")) {
$option = 1;
$article_obj =& $article_handler->get($spotlight_obj->getVar("art_id"));
$message = "
" . $article_obj->getVar('art_title') . "";
} else {
$option = 0;
$message = art_constant("AM_SPOTLIGHT_LASTARTICLE");
}
if (!$spotlight_obj->isNew()) {
$uid = $spotlight_obj->getVar("uid");
if ($xoopsUser->getVar("uid") == $uid) {
$uname = $xoopsUser->getVar("uname");
} else {
$uname = XoopsUser::getUnameFromId($uid);
}
$form_sp->addElement(new XoopsFormLabel(art_constant("AM_SPOTLIGHT_CURRENT"), "
" . $uname . " - " . $spotlight_obj->getTime() . ": " . $message));
}
// Image
if (!empty($xoopsModuleConfig['path_image'])) {
$sp_image = $spotlight_obj->getImage();
$image_option_tray = new XoopsFormElementTray(art_constant("AM_IMAGE_UPLOAD"), '
');
$image_option_tray->addElement(new XoopsFormFile('', 'userfile',''));
$form_sp->addElement($image_option_tray);
$form_sp->addElement(new XoopsFormText(art_constant("AM_IMAGE_CAPTION"), "sp_image_caption", 50, 255, @$sp_image["caption"]));
unset($image_tray);
unset($image_option_tray);
$image_option_tray = new XoopsFormElementTray(art_constant("AM_IMAGE_SELECT"), "
");
$image_array =& XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . "/". $xoopsModuleConfig["path_image"] . "/");
array_unshift($image_array, _NONE);
$image_select = new XoopsFormSelect("", "sp_image_file", @$sp_image["file"]);
$image_select->addOptionArray($image_array);
$image_select->setExtra("onchange="showImgSelected('img', 'sp_image_file', '/" . $xoopsModuleConfig["path_image"] . "/', '', '" . XOOPS_URL . "')"");
$image_tray = new XoopsFormElementTray("", "
");
$image_tray->addElement($image_select);
if (!empty($sp_image["url"])) {
$label = "
" . (empty($sp_image["caption"]) ? "" : "
" . $sp_image["caption"]);
} else {
$label = "
";
}
$image_tray->addElement(new XoopsFormLabel(art_constant("AM_IMAGE_CURRENT"), $label));
$image_option_tray->addElement($image_tray);
$form_sp->addElement($image_option_tray);
}
// Options
$spot_options = array(0=>art_constant("AM_SPOTLIGHT_LASTARTICLE"), 1=>art_constant("AM_SPOTLIGHT_SPECIFIED"));
$option_select = new XoopsFormSelect(art_constant("AM_SPOTLIGHT_OPTION"), 'option', $option);
$option_select->addOptionArray($spot_options);
$form_sp->addElement($option_select);
// CATEGORIES
$category_handler =& xoops_getmodulehandler('category', $GLOBALS["artdirname"]);
$categories =& $category_handler->getTree(0, "all");
$cat_option = array();
$cat_option[0] = _ALL;
foreach ($categories as $id => $cat) {
$cat_option[$id] = $cat['prefix'] . $cat['cat_title'];
}
$cat_select = new XoopsFormSelect(art_constant("AM_SPOTLIGHT_CATEGORIES"), 'sp_categories', $spotlight_obj->getVar("sp_categories"), 5, true);
$cat_select->addOptionArray($cat_option);
$form_sp->addElement($cat_select);
// Editor's Note
$form_sp->addElement(new XoopsFormTextArea(art_constant("AM_SPOTLIGHT_NOTE"), "sp_note", $spotlight_obj->getVar("sp_note")));
$criteria = new CriteriaCompo(new Criteria('art_time_publish', 0, ">"));
if (count($spotlight_obj->getVar("sp_categories")) > 0) {
$criteria->add(new Criteria('cat_id', '(' . implode(',', $spotlight_obj->getVar("sp_categories")) . ')', '>'), "AND");
}
$articles_count = $article_handler->getCount($criteria);
if ($articles_count > 0) {
$tags = array("art_title","cat_id");
$criteria->setStart($start);
$criteria->setLimit($xoopsModuleConfig["articles_perpage"]);
$articles_obj =& $article_handler->getAll($criteria, $tags);
foreach ( $articles_obj as $id => $article ) {
$cat_id[]=$article->getVar('cat_id');
}
$criteria = new Criteria("cat_id", "(" . implode(",", $cat_id) . ")", "IN");
$categories = $category_handler->getList($criteria);
$heading = array( "ID", art_constant("AM_TITLE"), art_constant("AM_CATEGORY"), art_constant("AM_SPOTIT") );
$article_table = "\n
"; $article_table .= "\n \n"; if ( $articles_count > $xoopsModuleConfig['articles_perpage']) { include XOOPS_ROOT_PATH . '/class/pagenav.php'; $nav = new XoopsPageNav($articles_count, $xoopsModuleConfig['articles_perpage'], $start, "start"); $article_table .= $nav->renderNav(4); } $article_table .= "\n |
\n";
$form_sp->addElement( $article_table );
}
$button_tray = new XoopsFormElementTray('', '');
$button_tray->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
$button_tray->addElement(new XoopsFormButton('', '', _CANCEL, 'button'));
$form_sp->addElement($button_tray);
$form_sp->display();
echo "
";