function showCategories() { global $xoopsModule, $mc, $tpl, $db, $xoopsSecurity; $categories = array(); $result = $db->query("SELECT * FROM " . $db->prefix("pw_categos") . " ORDER BY `order`,active"); while ($row = $db->fetchArray($result)) { $cat = new PWCategory(); $cat->assignVars($row); $link = PW_URL . '/' . ($mc['urlmode'] ? 'cat/' . $cat->nameId() . '/' : 'category.php?id=' . $cat->id()); $categories[] = array('id' => $cat->id(), 'link' => $link, 'name' => $cat->name(), 'active' => $cat->active(), 'order' => $cat->order(), 'works' => $cat->works(), 'nameid' => $cat->nameId(), 'description' => $cat->desc()); } // Event $categories = RMEvents::get()->run_event('works.list.categories', $categories); PWFunctions::toolbar(); xoops_cp_location('<a href="./">' . $xoopsModule->name() . "</a> » " . __('Works Categories', 'works')); RMTemplate::get()->assign('xoops_pagetitle', __('Works Categories', 'works')); RMTemplate::get()->add_style('admin.css', 'works'); RMTemplate::get()->add_script(RMCURL . '/include/js/jquery.checkboxes.js'); RMTemplate::get()->add_script('../include/js/admin_works.js'); RMTemplate::get()->add_head("<script type='text/javascript'>\nvar pw_message='" . __('Do you really want to delete selected categories?', 'works') . "';\n\n var pw_select_message = '" . __('You must select some category before to execute this action!', 'works') . "';</script>"); xoops_cp_header(); $works_extra_options = RMEvents::get()->run_event('works.more.options', $works_extra_options); include RMTemplate::get()->get_template("admin/pw_categories.php", 'module', 'works'); xoops_cp_footer(); }
function pw_categories_show($options) { global $xoopsModule, $xoopsModuleConfig; include_once XOOPS_ROOT_PATH . '/modules/works/class/pwwork.class.php'; include_once XOOPS_ROOT_PATH . '/modules/works/class/pwclient.class.php'; include_once XOOPS_ROOT_PATH . '/modules/works/class/pwcategory.class.php'; $db = XoopsDatabaseFactory::getDatabaseConnection(); if (isset($xoopsModule) && $xoopsModule->dirname() == 'works') { $mc =& $xoopsModuleConfig; } else { $mc =& RMUtilities::module_config('works'); } $db = XoopsDatabaseFactory::getDatabaseConnection(); $result = $db->query("SELECT * FROM " . $db->prefix("pw_categos") . " ORDER BY name"); $block = array(); while ($row = $db->fetchArray($result)) { $cat = new PWCategory(); $cat->assignVars($row); $ret = array(); $ret['name'] = $row['name']; $ret['link'] = $cat->link(); $block['categos'][] = $ret; } return $block; }
function pw_works_edit($options) { global $db; include_once XOOPS_ROOT_PATH . '/modules/works/class/pwclient.class.php'; include_once XOOPS_ROOT_PATH . '/modules/works/class/pwcategory.class.php'; //Tipo de Trabajo $form = new RMForm(__('Block Options', 'works'), 'form_options', ''); $ele = new RMFormSelect(__('Works type', 'works'), 'options[0]'); $ele->addOption(0, __('Reandom works', 'works'), $options[0] == 0 ? 1 : 0); $ele->addOption(1, __('Featured works', 'works'), $options[0] == 1 ? 1 : 0); $ele->addOption(2, __('Recent works', 'works'), $options[0] == 2 ? 1 : 0); $form->addElement($ele); //Obtenemos las categorías $ele = new RMFormSelect(__('Category', 'works'), 'options[1]'); $ele->addOption(0, __('All categories', 'works')); $db = XoopsDatabaseFactory::getDatabaseConnection(); $result = $db->query("SELECT * FROM " . $db->prefix('pw_categos') . " WHERE active=1"); while ($row = $db->fetchArray($result)) { $cat = new PWCategory(); $cat->assignVars($row); $ele->addOption($cat->id(), $cat->name(), $options[1] == $cat->id() ? 1 : 0); } $form->addElement($ele, true); //Obtenemos los clientes $ele = new RMFormSelect(__('Customer', 'works'), 'options[2]'); $ele->addOption(0, __('All customers', 'works')); $result = $db->query("SELECT * FROM " . $db->prefix('pw_clients')); while ($row = $db->fetchArray($result)) { $client = new PWClient(); $client->assignVars($row); $ele->addOption($client->id(), $client->name(), isset($ptions[2]) ? $options[2] == $client->id() ? 1 : 0 : 0); } $form->addElement($ele, true); //Número de trabajos $form->addElement(new RMFormText(__('Works number', 'works'), 'options[3]', 5, 5, isset($options[3]) ? $options[3] : ''), true); $form->addElement(new RMFormText(__('Columns', 'works'), 'options[4]', 5, 5, isset($options[4]) ? $options[4] : ''), true); $form->addElement(new RMFormYesno(__('Show work image', 'works'), 'options[5]', isset($options[5]) ? $options[5] ? 1 : 0 : 0), true); $form->addElement(new RMFormYesno(__('Show description', 'works'), 'options[6]', isset($options[6]) ? $options[6] ? 1 : 0 : 0), true); return $form->render(false); }