/** * @desc Visualiza todas las postales existentes **/ function showPostCards() { global $xoopsModule, $tpl, $xoopsModuleConfig, $xoopsSecurity; $mc =& $xoopsModuleConfig; $page = isset($_REQUEST['page']) ? intval($_REQUEST['page']) : 1; $limit = isset($_REQUEST['limit']) ? intval($_REQUEST['limit']) : 15; $limit = $limit <= 0 ? 15 : $limit; $db = XoopsDatabaseFactory::getDatabaseConnection(); //Barra de Navegación $sql = "SELECT COUNT(*) FROM " . $db->prefix('gs_postcards'); list($num) = $db->fetchRow($db->query($sql)); list($num) = $db->fetchRow($db->query($sql)); $start = $num <= 0 ? 0 : ($page - 1) * $limit; $tpages = ceil($num / $limit); $nav = new RMPageNav($num, $limit, $page, 5); $nav->target_url("postcards.php?page={PAGE_NUM}&limit={$limit}"); //Fin de barra de navegación $sql = "SELECT * FROM " . $db->prefix('gs_postcards'); $sql .= " LIMIT {$start},{$limit}"; $result = $db->query($sql); $posts = array(); $tf = new RMTimeFormatter(0, __('%M% %d%, %Y% - %h%:%i%:%s%', 'galleries')); while ($rows = $db->fetchArray($result)) { $post = new GSPostcard(); $post->assignVars($rows); $link = GSFunctions::get_url() . ($mc['urlmode'] ? 'postcard/view/id/' . $post->code() . '/' : '?postcard=view&id=' . $post->code()); $posts[] = array('id' => $post->id(), 'title' => $post->title(), 'date' => $tf->format($post->date()), 'toname' => $post->toName(), 'name' => $post->email(), 'view' => $post->viewed(), 'link' => $link); } GSFunctions::toolbar(); xoops_cp_location("<a href='./'>" . $xoopsModule->name() . "</a> » " . __('E-cards', 'galleries')); xoops_cp_header(); RMTemplate::get()->add_local_script('gsscripts.php?file=sets&form=frm-postcards&', 'galleries'); RMTemplate::get()->add_head("<script type='text/javascript'>\nvar delete_warning='" . __('Do you really wish to delete selected e-cards?', 'galleries') . "';\n</script>"); include RMTemplate::get()->get_template('admin/gs_postcards.php', 'module', 'galleries'); xoops_cp_footer(); }
/** * @desc Visualiza la postal **/ function viewPostcard() { global $tpl, $xoopsModule, $xoopsModuleConfig, $xoopsModuleConfig, $mc, $xoopsUser, $id; include_once XOOPS_ROOT_PATH . '/class/template.php'; $tpl = new XoopsTpl(); $mc =& $xoopsModuleConfig; if (!$xoopsUser) { redirect_header(XOOPS_URL . '/user.php#register', 1, _MS_GS_ERRUSR); die; } //Verificamos si la postal existe $post = new GSPostcard($id); if ($post->isNew()) { redirect_header(XOOPS_URL . '/modules/galleries/', 1, _MS_GS_ERRPOSTEXIST); die; } $img = new GSImage($post->image()); if ($img->isNew()) { redirect_header(XOOPS_URL . '/modules/galleries/', 1, _MS_GS_ERRIMG); die; } $user = new GSUser($img->owner(), 1); $file = $user->filesPath() . '/' . $img->image(); list($ancho, $alto) = getimagesize($file); $tpl->assign('gs_url', XOOPS_URL . '/modules/galleries'); $tpl->assign('img', array('id' => $img->id(), 'width' => $ancho, 'height' => $alto, 'url' => $user->filesURL() . '/' . $img->image(), 'link' => $user->userURL() . 'img/' . $img->id() . '/')); $tpl->assign('title', $post->title()); $tpl->assign('message', $post->message()); $tpl->assign('lang_says', sprintf(_MS_GS_SAYS, $post->name())); $tpl->assign('xoops_pagetitle', sprintf(_MS_GS_PTITLE, $post->title()) . ' » ' . $mc['section_title']); $tpl->assign('lang_see', _MS_GS_SEE); $tpl->assign('user_link', $user->userURL() . 'browse/' . $img->id() . '/'); $tpl->assign('lang_seeuser', _MS_GS_SEEUSER); $tpl->assign('preview', 0); RMTemplate::get()->add_xoops_style('postcard.css', 'galleries'); //Actualizar datos de postal $post->setViewed(1); $post->save(); echo $tpl->fetch("db:gs_postcard.html"); }
/** * @desc Visualiza la postal **/ function viewPostcard() { global $tpl, $xoopsModule, $xoopsModuleConfig, $xoopsModuleConfig, $mc, $xoopsUser, $id; include_once XOOPS_ROOT_PATH . '/class/template.php'; $tpl = new XoopsTpl(); $mc =& $xoopsModuleConfig; //Verificamos si la postal existe $post = new GSPostcard($id); if ($post->isNew()) { redirect_header(XOOPS_URL . '/modules/galleries/', 1, __('Specified E_Card does not exists!', 'galleries')); die; } $img = new GSImage($post->image()); if ($img->isNew()) { redirect_header(XOOPS_URL . '/modules/galleries/', 1, __('Sorry, there are some problems with this e-card!', 'galleries')); die; } $user = new GSUser($img->owner(), 1); $file = $user->filesPath() . '/' . $img->image(); list($ancho, $alto) = getimagesize($file); $tpl->assign('gs_url', XOOPS_URL . '/modules/galleries'); $tpl->assign('img', array('id' => $img->id(), 'width' => $ancho, 'height' => $alto, 'url' => $user->filesURL() . '/' . $img->image(), 'link' => $user->userURL() . 'img/' . $img->id() . '/')); $tpl->assign('title', $post->title()); $tpl->assign('message', $post->message()); $tpl->assign('lang_says', sprintf(__('%s says:'), $post->name())); $tpl->assign('xoops_pagetitle', sprintf(__('%s, E-Card', 'galleries'), $post->title()) . ' » ' . $mc['section_title']); $tpl->assign('lang_see', __('View Picture', 'galleries')); $tpl->assign('user_link', $user->userURL() . 'browse/' . $img->id() . '/'); $tpl->assign('lang_seeuser', __('View User Pictures', 'galleries')); $tpl->assign('preview', 0); RMTemplate::get()->add_xoops_style('postcard.css', 'galleries'); //Actualizar datos de postal $post->setViewed(1); $post->save(); echo $tpl->fetch("db:gs_postcard.html"); }