本文整理汇总了PHP中URI::Instance方法的典型用法代码示例。如果您正苦于以下问题:PHP URI::Instance方法的具体用法?PHP URI::Instance怎么用?PHP URI::Instance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类URI
的用法示例。
在下文中一共展示了URI::Instance方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __toString
public function __toString()
{
/**
* poa = product options atributes
*/
// echo Kohana::debug(@$_POST);
$opa = new fpp_product_has_attributes_product_Model();
$orm = $opa->db2cls();
$uri = URI::Instance();
$id = (int) $uri->segment("edit");
if (request::method() == 'post' and is_array(@$_POST['opt'])) {
$orm->delete(array('product_id_product' => $id));
foreach ($_POST['opt'] as $key => $value) {
$orm = $opa->db2cls();
$data['product_id_product'] = $id;
// $data['ap_id_attributes_product'] = @$_POST['atr'][$key];
$data['prefix'] = @$_POST['prefix'][$key];
$data['vap_id_values_atributtes_product'] = @$_POST['opt'][$key];
$data['value'] = @$_POST['val'][$key];
$data['extra'] = @$_POST['extra'][$key];
$orm->set_fields($data);
$orm->save();
}
}
$results = $this->GetAttr($id);
// fetch_where(array('product_id_product'=> ) );
$atr_p = new fpp_attributes_product_Model();
$orm_atrp = $atr_p->db2cls();
$attributes = form::dropdown("poa_id", $orm_atrp->select_list('id_attributes_product', 'name_attributes_product'));
$string = View::factory("extras/ajaxattributes")->set("attributes", $attributes)->set("results", $results)->render();
return $string;
}
示例2: detailnews
function detailnews($id)
{
$uri = URI::Instance();
// $id = (int) $uri->segment("detailnews");
// $this->_NoTemplate();
$orm = new fpp_news_Model();
$orm = $orm->db2cls($id);
$title_news = Basic::TransVar("title_news");
$content_news = Basic::TransVar("content_news");
$this->title = $orm->{$title_news};
$this->content = View::factory("main/page")->set("title", __("Eventos", false))->set("content", "<h4>" . $orm->{$title_news} . "</h4>" . $orm->{$content_news})->render();
// $this->content = View::factory("webservices/news_detail")
// ->set("news",$orm)
// ->render();
}
示例3: blockfields
//.........这里部分代码省略.........
$query = $query->where($where_string);
try {
$rows = $query->get();
} catch (Exception $e) {
echo Kohana::debug('Error: ' . "\n" . $e->getMessage() . "\n");
die;
}
//escribiendo los campos de acuerdo a sus propiedades
$data = new StdClass();
$types->base_uri = $this->base_uri;
$valid_count = FALSE;
foreach ($rows as $row) {
foreach ($OTMSelect as $nameOTM) {
$row->{$nameOTM} = 'null';
}
foreach ($row as $name => $value) {
$valid_count = TRUE;
if ($this->_OnlyRead == TRUE) {
$data->{$name} = $value;
} else {
$types->field_value = $value;
// Si el campo es un "OneToMany"
if ($types->fields->{$name}->typefield == 'OneToMany' or $types->fields->{$name}->typefield == 'TabularModel') {
if (@$OneToMany[$name]['table'] == '') {
$modtable = substr($types->fields->{$name}->model, 4);
$OneToMany[$name] = fpp::GetOTM($modtable, $this->_Table);
}
$OTMArr = null;
// Tomo el campo primario y secundario
$OTMdb_field = $OneToMany[$name]['secondary'];
$OTMdb_pk = $OneToMany[$name]['primary'];
$valuelistOTM = null;
try {
$valuelistOTM = $this->db->from($OneToMany[$name]['table'])->select($OTMdb_field)->where(array($OTMdb_pk => $id))->get();
} catch (Exception $e) {
echo Kohana::debug('Error: ' . "\n" . $e->getMessage() . "\n");
die;
}
foreach ($valuelistOTM as $rowOTM) {
$OTMArr[] = $rowOTM->{$OTMdb_field};
}
$types->field_value = $OTMArr;
}
$types->field_name = $name;
$arrayorder[$name] = $types->ObjectField($name);
}
}
foreach ($this->meta as $fieldname => $props) {
$data->{$fieldname} = $arrayorder[$fieldname];
}
}
} else {
foreach ($items as $name) {
$valid_count = TRUE;
$types->field_name = $name;
$types->field_value = NULL;
$data->{$name} = $types->ObjectField($name);
}
}
//VIRTUAL
if ($this->virtual != null) {
$dirf = dirname(__FILE__);
include_once $dirf . '/types/' . $this->virtual . '.php';
$data->virtualfield = new $this->virtual();
$data->virtualfield->id_table = $id;
$titles['virtualfield'] = $data->virtualfield->title;
}
if ($this->virtualclone != null) {
$dirf = dirname(__FILE__);
include_once $dirf . '/types/' . $this->virtualclone . '.php';
$data->virtualfieldc = new $this->virtualclone();
$data->virtualfieldc->id_table = $id;
$titles['virtualfieldc'] = $data->virtualfieldc->title;
}
//VIRTUAL
if ($valid_count == FALSE) {
return NULL;
}
$this->retfields = $data;
//Setting Ajax
$form = null;
$attrform = null;
if (@$_GET['AJAX_NO_LOAD'] == TRUE) {
$form .= '<script>$(document).ready(function(){$(".FORM_AJAX").submit(function(){ return post_ajax(this); })});</script>';
$attrform = array("class" => 'FORM_AJAX');
}
$urlform = NULL;
if ($id > 0) {
$this->uri = URI::Instance();
$urlform = str_replace("add", "edit/" . $id, $this->uri);
}
$form .= form::open_multipart($urlform, $attrform);
if ($this->GetFieldAjax != NULL) {
$FAjax = $this->GetFieldAjax;
return $data->{$FAjax};
}
$view_info = $this->_TabView == TRUE ? 'tabmodel' : 'info';
$str = View::factory($this->templatedir . $view_info)->set('msg', $msg)->set('data', $data)->set('form', $form)->set('only_read', $this->_OnlyRead)->set('titles', $titles)->set('tblname', $this->_Table)->render();
return $str;
}