当前位置: 首页>>代码示例>>PHP>>正文


PHP Component::redirect方法代码示例

本文整理汇总了PHP中Component::redirect方法的典型用法代码示例。如果您正苦于以下问题:PHP Component::redirect方法的具体用法?PHP Component::redirect怎么用?PHP Component::redirect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Component的用法示例。


在下文中一共展示了Component::redirect方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: on_success

	public function on_success($data)
	{
		$order_id = $this->EasyForms->field("id", INPUT_GET);
		$order_id = intval($order_id);
		if (empty($order_id))
			Component::redirect ("Корзина");

		$order = $this->Orders->get($order_id);
		if ($order_id === false)
			Component::redirect ("Корзина");

		if ($order['opened'] == 1)
			Component::redirect ("Корзина");

		$this->Orders->edit_order($order_id, array('opened' => 1));
		$order['id'] = $this->format_order_number($order_id);
		$this->Templates->bind_params($order);
	}
开发者ID:nDIGAH3CEYIiCsq,项目名称:gold,代码行数:18,代码来源:orders.inc.php

示例2: on_logout

	public function on_logout($data)
	{
		$this->Accounts->logout();
		Component::redirect("/");
	}
开发者ID:nDIGAH3CEYIiCsq,项目名称:gold,代码行数:5,代码来源:accounts.inc.php

示例3: go_action

	/**
	 * Перенаправляет пользователя на другой обработчик в данном модуле
	 * @param $action String: Обработчик в модуле
	 * @param $params Array: Массив дополнительных параметров для GET запроса
	 */
	protected function go_action($action, $params = array())
	{
		$module = ManagerAdmin::get_module();

		$request = array('module' => $module, 'action' => $action);
		$request = array_merge($request, $params);

		Component::redirect($_SERVER['SCRIPT_NAME'], $request);
		exit;
	}
开发者ID:nDIGAH3CEYIiCsq,项目名称:gold,代码行数:15,代码来源:manager.inc.php

示例4: on_add

	public function on_add()
	{	
		$this->Templates->set_page("Добавление заказа");
		$this->bind_list_params();

		if (!$this->EasyForms->field("send", INPUT_POST))
			return;

		$fields = array('name'		=> array('require' => false),
				'lastname'	=> array('require' => false),
				'patronymic'	=> array('require' => false),
				'legal'		=> array(),
				'delivery'	=> array('caption' => "Способ доставки"),
				'status'	=> array(),
				'pay'		=> array('caption' => "Способ оплаты"),
				'address'	=> array('require' => false),
				'phone'		=> array('require' => false),
				'products'	=> array()
			);
		$fields = $this->EasyForms->fields($fields);

		if ($fields === false)
			return;

		$list_products = explode("&", $fields['products']);
		$products = array();
		$price = 0;
		$initial_price = 0;
		while (list(, $product) = each($list_products))
		{
			$data = explode("|", $product);
			if (count($data) < 2)
				continue;

			$product = $this->Products->get_by_code($data[0]);
			if ($product === false)
				continue;

			$product['count'] = $data[1];
			if (count($data) == 3)
				$product['size'] = $data[2];

			$products[] = $product;
			$price += $product['price'] * $data[1];
			$initial_price += $product['initial_price'] * $data[1];
		}
		$fields['products'] = $products;
		$fields['price'] = $price;
		$fields['initial_price'] = $initial_price;
		$this->Orders->add($fields, false);

		Component::redirect($_SERVER['SCRIPT_NAME'], array('module' => "orders", 'action' => "index"));
	}
开发者ID:nDIGAH3CEYIiCsq,项目名称:gold,代码行数:53,代码来源:orders.inc.php

示例5: on_item

	public function on_item($data)
	{
		$names = explode(" ", $data['postfix']);
		if (count($names) < 2)
			Component::redirect("");

		$code = $names[count($names) - 1];
		$product = $this->Products->get_by_code($code);
		if ($product === false)
			Component::redirect("");

		$this->Templates->set_page("Шаблоны/Изделие");

		$product['image_big'] = $this->Products->get_image_big($product['id']);

		if (!empty($product['metal_id']))
		{
			$metal = $this->Dictionaries->Metals->get_by_id($product['metal_id']);
			$product['metal'] = $metal['name'];
		}

		if (!empty($product['probe_id']))
		{
			$probe = $this->Dictionaries->Probes->get_by_id($product['probe_id']);
			$product['probe'] = $probe['name'];
		}

		$stone_item = $this->Templates->stone_item;
		if ($stone_item === false)
			$this->Log->error("Can't find 'stone_item' param");
		$stones = "";
		$stones_fields = array("stone_id", "stone2_id", "stone3_id");
		foreach($stones_fields as $field)
		{
			if (empty($product['stone_id']))
				continue;

			$stone = $this->Dictionaries->Stones->get_by_id($product[$field]);
			if ($stone === false)
				continue;

			$stone_item->bind_params($stone);
			$stones .= (string) $stone_item;
		}

		$this->Templates->stones = $stones;

		$complect_item = $this->Templates->complect_item;
		if ($complect_item === false)
			$this->Log->error("Can't find 'complect_item' param");
		$product['complects'] = $this->get_products($product['complects'], $complect_item);

		$link_item = $this->Templates->link_item;
		if ($link_item === false)
			$this->Log->error("Can't find 'link_item' param");
		$product['links'] = $this->get_products($product['links'], $link_item);

		if (!empty($product['collection']))
		{
			$collection = $this->Dictionaries->Collections->get_by_id($product['collection']);
			if ($collection !== false)
				$this->Templates->bind_params($collection, "Collection::");
		}

		$this->Templates->bind_params($product);
		
		if (!$this->Products->bind_path_params($this->Templates, $product))
			Component::redirect ("/");

		$this->Basket->bind_product($this->Templates, $product['id']);

		$caregory_parent = $this->Categories->get($product['parent_id']);
		$this->Templates->{$caregory_parent->name} = true;
	}
开发者ID:nDIGAH3CEYIiCsq,项目名称:gold,代码行数:74,代码来源:products.inc.php

示例6: block

	private function block()
	{
		if (!$this->Templates->exist("/Ошибки/404"))
			Component::redirect("");

		header("Not Found", true, 404);

		if (empty($_SERVER['REDIRECT_URL']))
			$redirect_url = "/";
		else
			$redirect_url = $_SERVER['REDIRECT_URL'];

		$template = $this->Templates->get("/Ошибки/404");
		$template->REDIRECT_URL = htmlspecialchars($redirect_url, ENT_QUOTES);

		echo (string) $template;
		exit;
	}
开发者ID:nDIGAH3CEYIiCsq,项目名称:gold,代码行数:18,代码来源:manager.inc.php

示例7: on_open

	public function on_open()
	{
		$id = $this->EasyForms->field("id", INPUT_GET);
		if (empty($id))
			Component::redirect($_SERVER['SCRIPT_NAME'], array('module' => "questions", 'action' => "index"));

		$question = $this->Questions->get($id);
		if ($question === false)
			Component::redirect($_SERVER['SCRIPT_NAME'], array('module' => "questions", 'action' => "index"));

		$this->Templates->set_page("Вопрос");

		$this->Templates->bind_params($question);
	}
开发者ID:nDIGAH3CEYIiCsq,项目名称:gold,代码行数:14,代码来源:questions.inc.php

示例8: on_get

	/**
	 * Отображение содержания корзины
	*/
	public function on_get($data)
	{
		$account = false;
		if ($this->Accounts->is_authed())
			$account = $this->Accounts->get();


		if (!$this->EasyForms->field("send"))
		{
			$this->set_items();

			if ($account === false)
				return;

			$name = $account['name'];
			if (!empty($account['lastname']))
				$name .= " ".$account['lastname'];
			if (!empty($account['patronymic']))
				$name .= " ".$account['patronymic'];

			$account['name'] = $name;
			$this->Templates->bind_params($account, "field_");

			return;
		}

		$params = $data['params'];
		$this->check_params($params, array("email"));
		if (empty($params['email']))
			$this->Log->error("not exist param email");

		$fields = array('name'		=> array(),
				'phone'		=> array(),
				'email'		=> array(),
				'address'	=> array(),
				'comment'	=> array()
		    );
		$fields = $this->EasyForms->fields($fields, array('require' => false));

		$basket = $this->Basket->summary();
		$this->Templates->price = $basket['price'];
		$this->Templates->bind_params($fields, "field_");

		$fields['phone'] = trim($fields['phone']);
		$fields['email'] = trim($fields['email']);
		if (empty($fields['phone']) && empty($fields['email']))
		{
			$this->Errors->add("simple", array('phone' => "Необходимо указать телефон или email"));
			$this->set_items();
			return;
		}

		if ($basket['price'] < 1000)
		{
			$this->Errors->add(array('price'), "Минимальная сумма заказа 1000 рублей");
			$this->set_items();
			return;
		}

		$template = $this->Templates->get("/Страницы/Шаблоны/Письма/Заказ/Обычный");
		$product_item = $template->product_item;
		if ($product_item === false)
			$this->Log->error("Can't find 'product_item' param");

		$basket = $this->Basket->summary();
		$products = $basket['products'];
		$fields['price'] = $basket['price'];
		reset($products);
		$products_list = "";
		while (list(, $product) = each($products))
		{
			$product['image_small'] = $this->Products->get_image_small($product['id']);
			$product_item->bind_params($product);
			$products_list .= (string) $product_item;
		}

		$fields['account_id'] = $account['id'];
		$order_id = $this->Orders->add_order($fields);

		$this->Orders->add_order_items($order_id, $products);

		$fields['orders'] = $products_list;
		$fields['id'] = $order_id;

		if (!empty($fields['email']))
			$this->Mail->send($fields['email'], "Шаблоны/Письма/Заказ/Обычный", $fields);
		else if (!$this->Accounts->is_authed() && isset($_SESSION['email']))
			$this->Mail->send($_SESSION['email'], "Шаблоны/Письма/Заказ/Обычный", $fields);

		$this->Mail->send(MAIL_SUPPORT, "Шаблоны/Письма/Заказ/Обычный_техническое", $fields);

		$this->Basket->clear();

		$this->Templates->account = $this->Accounts->is_authed();

		Component::redirect("Заказ", array('id' => $order_id));
	}
开发者ID:nDIGAH3CEYIiCsq,项目名称:gold,代码行数:100,代码来源:basket.inc.php

示例9: on_add

	/**
	 * Добавлени новости
	 */
	public function on_add()
	{
		$fields = array('name'			=> array('require' => false),
				'category'		=> array('require' => false),
				'title'			=> array('require' => false),
				'short_text'		=> array('require' => false),
				'text'			=> array('require' => false),

				'position'		=> array('require' => false),
				'clear'			=> array('require' => false),

				'use_title'		=> array('require' => false),
				'use_text'		=> array('require' => false),
				'use_image'		=> array('require' => false),

				'files_names'		=> array('require' => false));
		$fields = $this->EasyForms->fields($fields);
		if ($fields === false)
			return;

		try
		{
			$this->News->save_image($fields);
			$this->News->save_files($fields);
		}
		catch(Exception $e)
		{
			$this->News->remove_files($fields['name'], $fields['category']);
			$this->Errors->add(array("news", "add"), $e->getMessage());
		}

		$params = $this->parse_params($fields);
		$this->News->add($fields, $params);

		$this->reset_cache();
		$this->reset_cache();
		Component::redirect($_SERVER['SCRIPT_NAME'], array('module' => "news", 'action' => "index"));
	}
开发者ID:nDIGAH3CEYIiCsq,项目名称:gold,代码行数:41,代码来源:news.inc.php

示例10: on_index

	/**
	 * Отображает титульную страницу модуля
	 */
	public function on_index()
	{
		$this->Admin->logout();
		Component::redirect($_SERVER['SCRIPT_NAME']);
	}
开发者ID:nDIGAH3CEYIiCsq,项目名称:gold,代码行数:8,代码来源:logout.inc.php

示例11: on_edit

	public function on_edit()
	{
		$this->Templates->set_page("Редактирование");
		if (!$this->EasyForms->field("send"))
		{
			$client_id = $this->EasyForms->field("id", INPUT_GET);
			$client_id = intval($client_id);
			if (empty($client_id))
				return;

			$client = $this->Accounts->get($client_id);
			if ($client === false)
				return;

			$this->Templates->bind_params($client);
			return;
		}

		$fields = array('id'		=> array('require' => true),
				'name'		=> array(),
				'phone'		=> array(),
				'day_birth'	=> array(),
				'month_birth'	=> array(),
				'year_birth'	=> array(),
				'lastname'	=> array(),
				'patronymic'	=> array(),
				'email'		=> array(),
				'card'		=> array());
		$fields = $this->EasyForms->fields($fields, array('type' => INPUT_POST, 'require' => false));
		$this->Templates->bind_params($fields);
		$client_id = $fields['id'];
		unset($fields['id']);
		$email = $fields['email'];
		unset($fields['email']);
		$this->Accounts->update_user($client_id, array('email' => $email));
		$this->Accounts->update_user_data($client_id, $fields);
		Component::redirect("admin", array('module' => "clients", 'action' => "index"));
	}
开发者ID:nDIGAH3CEYIiCsq,项目名称:gold,代码行数:38,代码来源:clients.inc.php


注:本文中的Component::redirect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。