public function execute() { $user_group = new SJB_UserGroup($_REQUEST); $add_user_group_form = new SJB_Form($user_group); $form_is_submitted = isset($_REQUEST['action']) && $_REQUEST['action'] == 'add'; $errors = null; $tp = SJB_System::getTemplateProcessor(); if ($form_is_submitted && $add_user_group_form->isDataValid($errors)) { SJB_UserGroupManager::saveUserGroup($user_group); $page = array('uri' => '/' . mb_strtolower($user_group->getPropertyValue('id'), 'UTF-8') . '-products/', 'module' => 'payment', 'function' => 'user_products', 'access_type' => 'user', 'parameters' => 'userGroupID=' . $user_group->getID()); $userPage = new SJB_UserPage(); $page_data = SJB_UserPage::extractPageData($page); $userPage->setPageData($page_data); $userPage->save(); $this->addLocationField($user_group->getSID()); SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . "/user-groups/"); } else { $add_user_group_form->registerTags($tp); $tp->assign('notifications', $user_group->getNotifications()); $tp->assign('notificationGroups', $user_group->getNotificationsGroups()); $tp->assign('form_fields', $add_user_group_form->getFormFieldsInfo()); $tp->assign('errors', $errors); $tp->display('add_user_group.tpl'); } }
protected function createListingTypePage(SJB_ListingType $listingType) { $listingsPage = array('uri' => '/manage-' . strtolower($listingType->getID()) . '-listings/', 'module' => 'classifieds', 'function' => 'manage_listings', 'access_type' => 'admin', 'parameters' => 'listing_type_sid=' . $listingType->getSID()); $userPage = new SJB_UserPage(); $pageData = SJB_UserPage::extractPageData($listingsPage); $userPage->setPageData($pageData); $userPage->save(); }
public static function extractPageData($request) { $page_data = SJB_UserPage::getNullPageData(); foreach ($request as $key => $value) { if ($value != null) { $page_data[$key] = $value; } } $page_data['parameters'] = SJB_UserPage::unserializeParameters($page_data['parameters']); return $page_data; }