function spewFeatured($params, $options) { $collectionDao = new \com\indigloo\sc\dao\Collection(); $groupDao = new \com\indigloo\sc\dao\Group(); $row = $collectionDao->glget(Nest::fgroups()); $feature_slug = empty($row) ? "" : $row["t_value"]; $groups = $groupDao->slugToGroupsMap($feature_slug); $title = "Featured groups"; $file = APP_WEB_DIR . "/view/group/cards.php"; include $file; }
<?php include 'sc-app.inc'; include APP_WEB_DIR . '/inc/header.inc'; use com\indigloo\sc\util\Nest; //public data //do not put user role check here set_exception_handler('webgloo_ajax_exception_handler'); $groupDao = new \com\indigloo\sc\dao\Group(); $collectionDao = new \com\indigloo\sc\dao\Collection(); $row = $collectionDao->glget(Nest::fgroups()); $feature_slug = empty($row) ? "" : $row["t_value"]; $fgroups = $groupDao->slugToGroupsMap($feature_slug); $html = \com\indigloo\sc\html\Group::getCloud($fgroups); echo $html;
$gWeb = \com\indigloo\core\Web::getInstance(); $fvalues = array(); $fUrl = \com\indigloo\Url::tryFormUrl("fUrl"); try { $fhandler = new Form\Handler("web-form-1", $_POST); $fvalues = $fhandler->getValues(); if ($fhandler->hasErrors()) { throw new UIException($fhandler->getErrors()); } $group_slug = ""; $slugs = Util::tryArrayKey($fvalues, "g"); if (!is_null($slugs)) { //remove duplicate entries $slugs = array_unique($slugs); //input - new groups are names / old ones are slugs $slugs = array_map(array("\\com\\indigloo\\util\\StringUtil", "convertNameToKey"), $slugs); //db slugs are space separated for sphinx indexing $group_slug = implode(Constants::SPACE, $slugs); } $collectionDao = new \com\indigloo\sc\dao\Collection(); $collectionDao->glset(Nest::fgroups(), $group_slug); //success $gWeb->store(Constants::FORM_MESSAGES, array("featured groups list updated!")); header("Location: " . $fUrl); } catch (UIException $ex) { $gWeb->store(Constants::STICKY_MAP, $fvalues); $gWeb->store(Constants::FORM_ERRORS, $ex->getMessages()); header("Location: " . $fUrl); exit(1); } }