public function selectPaymentOptionsAction() { $packages = $this->package->findAll(); $payPal = $this->paymentProcessor->findByPk("PayPal"); $allopass = $this->paymentProcessor->findByPk("Allopass"); $allopassNumbers = array(); foreach ($packages as &$package) { $details = ""; if ($payPal->active) { $details .= " " . $package['amount'] . " " . $payPal->currency; } if ($payPal->active && $allopass->active && $package['allopassNumber']) { $details .= " or "; } if ($allopass->active && $package['allopassNumber']) { $details .= $package['allopassNumber'] . " Allopass"; } $package['details'] = $details; $allopassNumbers[$package['packageId']] = $package['allopassNumber']; } $this->set("packages", $packages); $this->set("allopassNumbersJSON", JsonView::php2js($allopassNumbers)); $c = new Criteria(); $c->add("active", 1); $this->set("paymentProcessors", $this->paymentProcessor->getArray($c, "displayName")); }
/** * Display site edit form */ function editAction($siteId) { $this->set("siteId", $siteId); $c = new Criteria(); $c->add("siteId", $siteId); $site = $this->site->find($c); if (empty($site)) { return $this->return404(); } $package = $site->packageId ? $this->package->findByPk($site->packageId) : null; $this->set("package", $package); // Decide to display link to remove image or not $this->set("displayRemoveImage", $site->imageSrc && !$site->ascreen ? true : false); $site->updateImageSrc(false); $site->categoryParentsData = $this->category->getParents($site->categoryId); $this->site->attachPhotos($site); $this->site->fillExtraFields($site); $this->site->attachKeywordIds($site); $site['additionalCategoryIds[]'] = $this->siteAdditionalCategory->getCategoryIdsBySiteId($site->siteId); $this->set("site", $site); $this->set("siteJson", JsonView::php2js($site)); $c = new Criteria(); $c->add("siteId", $siteId); $this->set("comments", $this->comment->findAll($c)); $this->set("selectCategories", $this->category->createOptionsList()); $c = new Criteria(); $c->add("role", "webmaster"); $this->set("webmasters", $this->user->getArray($c, "email")); $this->set("allKeywordsList", $this->keyword->generateSortedList()); $this->set("yesNoOptions", array("0" => _t("No"), "1" => _t("Yes"))); $this->set("priorites", range(0, 10)); $this->set("adCriterias", $this->adCriteria->getSelectList()); require CODE_ROOT_DIR . "config/flags.php"; $this->set("countryFlags", $countryFlags); }
/** * Display edit form */ function editSiteAction($siteId) { $site = $this->site->findByPk($siteId); if (empty($site) || $site->webmasterId != $this->userId) { $this->return404(); } $this->site->attachPhotos($site); $this->site->fillExtraFields($site); $this->site->attachKeywordIds($site); $this->set("edit", true); $this->set("item", $site); $this->set("itemJson", JsonView::php2js($site)); $this->set("siteType", $site->siteType); $package = $site->packageId ? $this->package->findByPk($site->packageId) : null; $this->set("package", $package); require CODE_ROOT_DIR . "config/flags.php"; $this->set("countryFlags", $countryFlags); $this->set("allKeywordsList", $this->keyword->generateSortedList()); $this->viewFile = "submitWebsite"; }
/** * Display sites which containt searched phrase */ function searchAction($searchQuery = "") { //set adPage for ads Display::set("adPage", "search"); Display::set("searchPanel", true); $searchedItems = array(); $this->request->fromArray($_GET); $searchValues = $this->request->toArray(); $this->set("searchValuesJson", JsonView::php2js($searchValues)); $page = !empty($this->request->page) ? $this->request->page : 1; $resultsCount = 0; //if something was searched if (!empty($searchValues)) { //get sites which containt searched phrase $searchedItems = $this->siteSearcher->searchValidated($searchValues, $page); $resultsCount = $this->siteSearcher->getFoundRowsCount(); //if this phrase have matched sites save tag if (!empty($searchedItems) && !empty($this->request->phrase)) { $this->searchTag->addSearchTag($this->request->phrase, $searchedItems[0]); } $this->set('searchValues', $searchValues); //prepare data for pagination $totalPages = empty($searchedItems) ? 0 : ceil($resultsCount / Config::get("sitesPerPageInSearch")); } else { //nothing was searched $searchedItems = array(); $totalPages = 0; $page = 1; } $this->set("resultsCount", $resultsCount); $this->set("searchedSites", $searchedItems); $searchArray = array(); foreach (explode("&", ltrim($searchQuery, "?")) as $searchPair) { if (strpos($searchPair, "=") === false) { continue; } list($key, $value) = explode("=", $searchPair); if (!$value || in_array($key, array("page", "search"))) { continue; } $searchArray[urldecode($key)] = urldecode($value); } $paginationBaseLink = "/site/search/?" . str_replace("%", "%%", http_build_query($searchArray)) . "&page="; $this->set("pageNavigation", array("baseLink" => $paginationBaseLink, "totalPages" => $totalPages, "currentPage" => $page)); }
function editPackageAction($packageId) { $package = $this->package->findByPk($packageId); $this->set('displayRemoveImage', $package->imageSrc ? true : false); $package->updateImageSrc(); $this->set("package", $package); $this->set("packageJSON", JsonView::php2js($package)); $this->set("priorities", range(0, 10)); }
/** * Display category edit form */ function editAction($categoryId) { $category = $this->category->findByPk($categoryId); $this->set("category", $category); $this->set("categoryJson", JsonView::php2js($category)); $this->set("categoryExtraFields", $this->extraField->getCategoryFields($categoryId)); $this->set("categoriesSelect", $this->category->createOptionsList()); }
function editAction($fieldId) { $extraField = $this->extraField->findByPk($fieldId); if (empty($extraField)) { $this->return404(); } $extraField->options = $this->extraField->getOptions($fieldId); $config = unserialize($extraField->config); if (is_array($config)) { foreach ($config as $key => $value) { $extraField['config[' . $key . ']'] = $value; } } $this->set("extraField", $extraField); $this->set("extraFieldJson", JsonView::php2js($extraField)); $this->set('returnUrl', $this->request->getRefererUrl()); }