function add() { if (!empty($this->request->data)) { $this->DailyopSection->create(); $this->request->data['DailyopSection']['uri'] = Tools::safeUrl($this->request->data['DailyopSection']['name']); if ($this->DailyopSection->save($this->request->data)) { $this->Session->setFlash(__('The dailyop section has been saved')); $this->redirect(array('action' => 'edit', $this->DailyopSection->id)); } else { $this->Session->setFlash(__('The dailyop section could not be saved. Please, try again.')); } } $tags = $this->DailyopSection->Tag->find('list'); $this->set(compact('tags')); }
public function create_article() { if (count($this->request->data) > 0) { $this->request->data['Article']['publish_date'] = $this->request->data['Article']['pub_date'] . " " . $this->request->data['Article']['pub_time'] . ":00"; //die(pr($this->request->data)); $this->request->data['Article']['uri'] = Tools::safeUrl($this->request->data['Article']['title']) . ".html"; if ($this->Article->save($this->request->data)) { $this->Session->setFlash("Article Created Successfully"); return $this->redirect(array("action" => "edit", $this->Article->id)); } } //make some select lists $articleTypes = $this->Article->ArticleType->find("list"); $aberricaCategories = $this->Article->AberricaCategory->generatetreelist(null, null, null, "-"); $this->set(compact("articleTypes", "aberricaCategories")); }
private function buildMatchMap($event = false, $users = false) { $map = array(); foreach ($event['Brackets'] as $bracket) { foreach ($bracket as $match) { if (!empty($match['BatbMatch']['player1_user_id']) && !empty($match['BatbMatch']['player2_user_id'])) { $player1 = $users[$match['BatbMatch']['player1_user_id']]; $player2 = $users[$match['BatbMatch']['player2_user_id']]; $match_id = $match['BatbMatch']['id']; $key = Tools::safeUrl($player1['first_name'] . " " . $player1['last_name'] . " vs " . $player2['first_name'] . " " . $player2['last_name']); $map[$key] = $match_id; } } } return $map; }
private function buildMatchMap($event = false, $users = false) { $token = "batb4_match_map"; if (($map = Cache::read($token, "1min")) === false) { $map = array(); foreach ($event['Brackets'] as $bracket) { foreach ($bracket as $match) { if (!empty($match['BatbMatch']['player1_user_id']) && !empty($match['BatbMatch']['player2_user_id'])) { $player1 = $users[$match['BatbMatch']['player1_user_id']]; $player2 = $users[$match['BatbMatch']['player2_user_id']]; $match_id = $match['BatbMatch']['id']; $key = Tools::safeUrl($player1['first_name'] . " " . $player1['last_name'] . " vs " . $player2['first_name'] . " " . $player2['last_name']); $map[$key] = $match_id; } } } Cache::write($token, $map, "1min"); } return $map; }
public function rg_static_posts() { $posts = $this->Dailyop->find('all', array("conditions" => array("Dailyop.dailyop_section_id" => 103), "contain" => array())); foreach ($posts as $k => $v) { $data = array("name" => $v['Dailyop']['name'], "sub_title" => $v['Dailyop']['sub_title'], "uri" => Tools::safeUrl($v['Dailyop']['name'] . " " . $v['Dailyop']['sub_title']) . ".html", "fb_like_uri_override" => "/run-and-gun/" . $v['Dailyop']['uri'], "url" => "/run-and-gun/" . $v['Dailyop']['uri'], "active" => 1, "dailyop_section_id" => 2, "publish_date" => $v['Dailyop']['publish_date']); $this->Dailyop->create(); $this->Dailyop->save($data); } }
public function add_news_post() { if (count($this->request->data) > 0) { $this->request->data['Dailyop']['publish_date'] = $this->request->data['Dailyop']['pub_date'] . " 00:00:00"; $this->request->data['Dailyop']['dailyop_section_id'] = 65; $this->request->data['Dailyop']['uri'] = Tools::safeUrl($this->request->data['Dailyop']['name']) . ".html"; $this->request->data['Dailyop']['news_post'] = 1; $this->request->data['Dailyop']['active'] = 0; $this->request->data['Dailyop']['hidden'] = 1; $this->request->data['Dailyop']['promo'] = 1; $this->request->data['Dailyop']['user_id'] = $this->user_id_scope; $this->Dailyop->save($this->request->data); $cb = "/dailyops/manage_news"; if (isset($this->request['named']['cb'])) { $cb = base64_decode($this->request['named']['cb']); } return $this->redirect($cb); } if (isset($this->request['named']['publish_date'])) { $this->request->data['Dailyop']['pub_date'] = $this->request['named']['publish_date']; } }
public function sections() { $this->loadModel("DailyopSection"); $s = $this->DailyopSection->find("all", array("contain" => array())); foreach ($s as $v) { $this->DailyopSection->create(); $this->DailyopSection->id = $v['DailyopSection']['id']; $this->DailyopSection->save(array("uri" => Tools::safeUrl($v['DailyopSection']['name']))); } }
public function add() { if (count($this->request->data) > 0) { $this->fixPublishDate(); $this->request->data['Tag'] = $this->CanteenProduct->Tag->parseTags($this->request->data['CanteenProduct']['tags']); if (empty($this->request->data['CanteenProduct']['uri'])) { $brand = $this->CanteenProduct->Brand->find("first", array("conditions" => array("Brand.id" => $this->request->data['CanteenProduct']['brand_id']), "contain" => array())); $ustr = $brand['Brand']['name'] . " " . $this->request->data['CanteenProduct']['name'] . " " . $this->request->data['CanteenProduct']['sub_title']; $this->request->data['CanteenProduct']['uri'] = Tools::safeUrl($ustr) . ".html"; } $this->request->data['CanteenProduct']['display_weight'] = 99; $this->CanteenProduct->save($this->request->data); $new_id = $this->CanteenProduct->id; //add in all the product prices in the default config $curr = CanteenConfig::get("currencies"); foreach ($curr as $c) { $this->CanteenProduct->CanteenProductPrice->create(); $this->CanteenProduct->CanteenProductPrice->save(array("canteen_product_id" => $new_id, "currency_id" => $c)); } return $this->flash("Product Added Successfully", "/canteen_products/edit/" . $new_id); } else { $this->request->data['CanteenProduct']['pub_date'] = date("Y-m-d", strtotime("+30 Day")); $this->request->data['CanteenProduct']['pub_time'] = "00:00"; } $this->canteenProductSelects(); }
public function fix_email_urls() { $this->loadModel("Dailyop"); //15 $posts = $this->Dailyop->find("all", array("conditions" => array("Dailyop.dailyop_section_id" => 15), "contain" => array())); foreach ($posts as $v) { $uri = Tools::safeUrl(date("F-jS-Y", strtotime($v['Dailyop']['publish_date']))) . ".html"; $this->Dailyop->create(); $this->Dailyop->id = $v['Dailyop']['id']; $this->Dailyop->save(array("uri" => $uri)); } }