本文整理汇总了PHP中Method::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Method::model方法的具体用法?PHP Method::model怎么用?PHP Method::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Method
的用法示例。
在下文中一共展示了Method::model方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: campaignAction
function campaignAction()
{
$this->filter();
$pagination = new Pagination(array('action' => $this->action, 'controller' => $this->controller, 'params' => $this->params));
$models = AFActiveDataProvider::models('Pixelrate', $this->params, $pagination);
$pixelrates = $models->getAllGroupByCampaign();
$id = AF::get($this->params, 'campaign_id');
$methods = Method::model()->cache()->findAllInArray();
Assets::js('jquery.form');
$this->addToPageTitle('Pixel rates');
$this->render('campaign', array('pixelrates' => $pixelrates, 'pagination' => $pagination, 'methods' => $methods, 'campaign_id' => $id));
}
示例2: actionMethod
function actionMethod($id = null)
{
if ($id == null) {
$this->render('methods', array('methods' => Method::model()->findAll()));
} else {
$c = Method::model()->findByPk($id);
if ($c == null) {
throw new CHttpException(404, 'The requested page does not exist.');
}
$this->render('method', array('method' => $c));
}
}
示例3: updateAction
function updateAction()
{
$model = new Profile();
if (isset($_POST['ajax'])) {
// Add method to profile
if (isset($_POST['model']) && $_POST['model'] == 'profiles_methods') {
$profileMethod = new ProfileMethod();
@$this->performAjaxValidation($profileMethod);
// Uncomment the line if AJAX validation is needed
if ($_POST['action'] == 'create') {
$profileMethod->fillFromArray($_POST, TRUE);
} elseif ($_POST['action'] == 'update') {
$methodID = (int) AF::get($_POST, 'method_id');
$profileID = (int) AF::get($_POST, 'profile_id');
$profileMethod = ProfileMethod::model()->findByPk(array('method_id' => $methodID, 'profile_id' => $profileID));
$profileMethod->fillFromArray($_POST);
}
if ($profileMethod->method_id == Method::METHOD_CC) {
if (isset($_POST['flags']['filter']) && $_POST['flags']['filter']) {
if (!$profileMethod->flags) {
$profileMethod->flags = '';
}
@$profileMethod->addFlags('filter');
} else {
$profileMethod->removeFlags('filter');
}
}
if (!$profileMethod->flags) {
$profileMethod->flags = '';
}
if ($profileMethod->save()) {
$link = AF::link(array('profiles' => 'update'), array('id' => $profileMethod->profile_id));
Message::echoJson('success', array('redirect' => $link));
} else {
Message::echoJsonError(__('profile_method_not_' . $_POST['action'] . 'd') . '. ' . $profileMethod->errors2string);
}
}
if (isset($_POST['getprofilemethodinfo'])) {
$methodID = (int) AF::get($_POST, 'method_id');
$profileID = (int) AF::get($_POST, 'profile_id');
$methods = Method::model()->cache()->findAllInArray();
//$model = ProfileMethod::model()->find("profiles_methods_id=:profiles_methods_id", array(':profiles_methods_id'=>$id));
$model = ProfileMethod::model()->findByPk(array('method_id' => $methodID, 'profile_id' => $profileID));
echo $this->view->includeFile('_methods_form', array('application', 'views', 'profiles'), array('action' => 'update', 'ajax' => TRUE, 'popup' => TRUE, 'methodModel' => $model, 'methods' => $methods));
die;
}
}
if (isset($_POST['model'])) {
// Change profile_name
if ($_POST['model'] == 'profile') {
if (isset($_POST['ajax'])) {
$this->performAjaxValidation($model);
// Uncomment the line if AJAX validation is needed
$model->fillFromArray($_POST, FALSE);
$model->user_id_updated = $this->user->user_id;
$model->updated = 'NOW():sql';
$model->model_uset_id = $this->user->user_id;
if ($model->save()) {
$link = AF::link(array('profiles' => 'update'), array('id' => $model->PkValue));
Message::echoJson('success', array('redirect' => $link));
} else {
Message::echoJsonError(__('profile_no_updated'));
}
die;
}
$this->redirect();
die;
}
// Add gateway to profile
if ($_POST['model'] == 'profiles_gateways') {
$profileGateway = new ProfileGateway();
$this->performAjaxValidation($profileGateway);
// Uncomment the line if AJAX validation is needed
$profileGateway->fillFromArray($_POST, TRUE);
$profileGateway->addGateway();
}
}
$id = AF::get($this->params, 'id', FALSE);
$pagination = new Pagination(array('action' => $this->action, 'controller' => $this->controller, 'params' => $this->params));
$models = AFActiveDataProvider::models('ProfileGateway', $this->params, $pagination);
$profile_methods = ProfileMethod::model()->getProfileMethodsByProfile($id);
//$method_ids = '0';
if ($profile_methods) {
foreach ($profile_methods as $key => $value) {
$method_id_array[] = $value['method_id'];
}
$method_ids = implode(',', $method_id_array);
}
$methods = Method::model()->cache()->findAllInArray();
$gateways = Gateway::model()->getGateways();
if (!$id) {
throw new AFHttpException(0, 'no_id');
}
if (!$model->findByPk($id)) {
throw new AFHttpException(0, 'incorrect_id');
}
//for create profile method
$modelProfileMethod = new ProfileMethod();
$modelProfileMethod->profile_id = $model->profile_id;
Assets::js('jquery.form');
//.........这里部分代码省略.........
示例4: actionMethodComplete
public function actionMethodComplete($term, $filter = "")
{
$extrawhere = '';
if ($filter == 'signal') {
$extrawhere = "and t.access = 'signal'";
}
$all = Method::model()->findAll(array('select' => 'id_method, t.id_class, t.name', 'condition' => "concat( c.name, '::', t.name ) like :txt {$extrawhere}", 'order' => 'c.name, t.name', 'join' => 'join class c using(id_class)', 'limit' => 10, 'params' => array('txt' => "%{$term}%")));
$matches = array();
foreach ($all as $m) {
$matches[] = array('value' => $m->signature_name(), 'id' => $m->id_method);
}
/* $sql_command = Yii::app()->db->createCommand()
->select("concat( c.name, '::', m.name ) value, id_method as id" )
->from ( 'method m' )
->join ( 'class c','c.id_class = m.id_class' )
->where ( " concat( c.name, '::', m.name ) like :txt $extrawhere",
array('txt'=>"%$term%") )
->order ( 'c.name, m.name' )
->limit ( 10 );
$matches = $sql_command->queryAll();*/
echo json_encode($matches);
}
示例5: cpp_decl
function cpp_decl($indent = 0)
{
$indo = "\n" . str_repeat(' ', $indent);
$ind = "\n" . str_repeat(' ', $indent + 4);
$r = "class {$this->name}";
$this->with('parents');
$parrarr = array();
foreach ($this->parents as $p) {
$parrarr[] = $p->full_name();
}
if (count($parrarr)) {
$r .= " : " . implode(", ", $parrarr);
}
$r .= "{$indo}{";
if ($this->qobject) {
$r .= "{$ind} Q_OBJECT";
}
if (strlen(trim($this->extra_declaration)) > 0) {
$decls = explode("\n", $this->extra_declaration);
$r .= "{$ind}//begin extra declarations";
foreach ($decls as $d) {
$r .= $ind . $d;
}
$r .= "{$ind}//end extra declarations";
}
// static data
$access = array('private', 'protected', 'public', 'signal');
foreach ($access as $acc) {
$attr = Attribute::model()->findAll(array('condition' => "id_class=:id and static=1 and access='{$acc}'", 'params' => array('id' => $this->id_class), 'order' => 'name'));
if (count($attr)) {
$r .= "{$indo}{$acc}:";
foreach ($attr as $a) {
$r .= $ind . $a->cpp_doc($indent + 4) . $ind . $a->cpp_decl();
}
$r .= "\n";
}
}
// static functions
foreach ($access as $acc) {
$attr = Method::model()->findAll(array('condition' => "id_class=:id and static=1 and access='{$acc}'", 'params' => array('id' => $this->id_class), 'order' => 'name'));
if (count($attr)) {
$r .= "{$indo}{$acc}:";
foreach ($attr as $a) {
$r .= $ind . $a->cpp_doc($indent + 4) . $ind . $a->cpp_decl();
}
$r .= "\n";
}
}
// non-static data
$accessors = '';
foreach ($access as $acc) {
$attr = Attribute::model()->findAll(array('condition' => "id_class=:id and static=0 and access='{$acc}'", 'params' => array('id' => $this->id_class), 'order' => 'name'));
if (count($attr)) {
$r .= "{$indo}{$acc}:";
foreach ($attr as $a) {
$r .= $ind . $a->cpp_doc($indent + 4) . $ind . $a->cpp_decl();
$accessors .= $a->accessors($indent + 4);
}
$r .= "\n";
}
}
// accessors
if (strlen($accessors) > 0) {
$r .= $indo . "public:\n" . $accessors;
}
// non-static functions
foreach ($access as $acc) {
$attr = Method::model()->findAll(array('condition' => "id_class=:id and static=0 and access='{$acc}'", 'params' => array('id' => $this->id_class), 'order' => 'name, const, id_method'));
if (count($attr)) {
$r .= "{$indo}{$acc}:";
foreach ($attr as $a) {
$r .= $ind . $a->cpp_doc($indent + 4) . $ind . $a->cpp_decl();
}
$r .= "\n";
}
}
return "{$r}{$indo}};";
}
示例6: actionUnitMethod
function actionUnitMethod($method)
{
$meth = Method::model()->findByPk($method);
if ($meth == null) {
throw new CHttpException(404, 'Method not found :-(');
}
$t = UnitTest::model()->findByAttributes(array('id_method' => $method));
if ($t != null) {
$this->redirect(array('view', 'id' => $t->id_test));
} else {
$model = new Test();
$special = new UnitTest();
$special->id_method = $id_method;
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Test'])) {
$model->attributes = $_POST['Test'];
$special->id_test = 0;
if ($model->save()) {
$special->id_test = $model->id_test;
$special->save(false);
$this->redirect(array('view', 'id' => $model->id_test));
}
}
$this->render('create', array('model' => $model, 'special' => $special));
}
}
示例7:
<?php
/// @warning HARD CODED DB PK!!!!!!!!!!!
$methods = Method::model()->findAll();
$table = $table_creator->begin_table("|m{3cm}|m{6cm}|m{2cm}|m{2cm}|") . $table_creator->heading_row(array("Classe", "Metodo", "Righe", "Test"));
foreach ($methods as $m) {
$class = Class_Prog::model()->findByPK($m->id_class)->name;
$table .= $table_creator->row(array($class, $m->name, '', ''));
}
$table .= $table_creator->caption("Tabella metodi") . $table_creator->end_table();
if ($table_creator->id() != 'html' && !$raw) {
echo CodeGen::generic_render_code($table, 'latex', true);
} else {
echo $table;
}
示例8: createAction
public function createAction()
{
$model = new Order();
$_POST['status'] = 'new';
$isPayment = AF::get($_POST, 'is_payment');
if (!$isPayment) {
$_POST['ps'] = 'pn';
$_POST['payment_method'] = 'cc_debit';
}
/*$rtr = '';
foreach($_POST as $k => $v) {
$rtr .= " '".$k."' => '".$v."',";
}
Message::echoJsonSuccess($rtr);*/
// is this also a new customer creation
if (isset($_POST['newCus']) && $_POST['newCus'] == 1) {
$cust = new Customer();
$this->performAjaxValidation($cust);
//$shipData = (array)json_decode($_POST['shipAddr']);
//$shipData['address_type'] = 'shipping';
$this->performAjaxFormFieldsValidation($_POST, explode(',', 'shipping_fname,shipping_lname,shipping_phone,shipping_address1,shipping_city,shipping_state_id,shipping_country_id,shipping_zip'));
//Message::echoJsonSuccess('made it2');
if (!$_POST['billingSameAsShipping']) {
//$billData = (array)json_decode($_POST['billAddr']);
//$billData['address_type'] = 'billing';
$this->performAjaxFormFieldsValidation($_POST, explode(',', 'billing_fname,billing_lname,billing_phone,billing_address1,billing_city,billing_state_id,billing_country_id,billing_zip'));
}
$orderRules = "campaign_id,gateway_id,shipping_id,amount_product,amount_shipping,payment_total";
} else {
$_POST['newCus'] = 0;
$orderRules = "customer_id,campaign_id,gateway_id,shipping_id,amount_product,amount_shipping,payment_total,address_id,billing_address_id";
if (isset($_POST['address_id']) && empty($_POST['billing_address_id'])) {
$_POST['billing_address_id'] = $_POST['address_id'];
}
// before billing validation
}
// Uncomment the following line if AJAX validation is needed
$this->performAjaxValidation($model, explode(',', $orderRules));
if (isset($_POST['model']) && $_POST['model'] == 'Order') {
$isOrderPay = $this->access->actionAccess('order_is_pay') ? (bool) AF::get($_POST, 'is_payment') : false;
$_POST['is_payment'] = $isOrderPay ? 1 : 0;
// JSON success and error commands handled in the WS functions
$ws = new WS();
$ws->crmInit($_POST);
$ws->process();
}
$orderID = AF::get($this->params, 'order_id', false);
$prospectID = AF::get($this->params, 'prospect_id', false);
$payments = array();
if ($orderID) {
$model->fillFromDbPk($orderID);
// if we use clone model then we cannot grab related fields
$model->getCopyModel();
$orderProducts = OrderProducts::getProductsArrayByOrder($model->order_id);
$payment_methods = ProfileGateways::getMethodsByProfileGateway($model->campaign->profile_id, $model->gateway_id);
$cPayments = new Payments('Payment');
$payments = $cPayments->getResultsByCustomerId($model->customer_id, false);
} elseif ($prospectID) {
$modelProspect = Prospect::model()->findByPk($prospectID);
if (!$modelProspect) {
throw new AFHttpException(0, 'incorrect_id');
}
$model->customer_id = $modelProspect->customer_id;
$model->campaign_id = $modelProspect->campaign_id;
$model->address_id = $modelProspect->address_id;
$orderProducts = array();
$payment_methods = array();
} else {
$orderProducts = array();
$payment_methods = array();
}
$productModel = new Product();
$products = $productModel->getAvailableByCampaignID($model->campaign_id);
$countryModel = new Country();
$languages = $countryModel->getLanguages();
$states = $model->country_id ? State::model()->getStatesByCID($model->country_id) : array();
//$model->country_ids='de,ir';
$countries = $countryModel->getCountries();
$campaigns = Campaign::model()->cache()->findAllInArray();
$shippingModel = new Shipping();
$shipping = $shippingModel->getAvailableByCampaignID($model->campaign_id);
$modelGateways = new Gateway();
//$modelGateways->getGateways()
$gateways = $orderID ? $modelGateways->getAvailableByCampaignID($model->campaign_id) : array();
$methods = Method::model()->cache()->findAllInArray();
$fields_expyear = array('current_year' => date("Y"), 'last_year' => date("Y") + 12);
Assets::js('jquery.form');
Assets::js('jquery.autocomplete');
Assets::js('as24.bind-1.3.5.min');
Assets::js('jquery-ui');
Assets::css('jquery-ui');
$this->addToPageTitle('Create Order');
$this->render('create', array('model' => $model, 'products' => $products, 'languages' => $languages, 'campaigns' => $campaigns, 'states' => $states, 'countries' => $countries, 'fields_expyear' => $fields_expyear, 'shipping' => $shipping, 'gateways' => $gateways, 'orderProducts' => $orderProducts, 'payment_methods' => $payment_methods, 'payments' => $payments, 'methods' => $methods));
}
示例9:
<?php
echo $form->errorSummary($model);
?>
<div class="row">
<?php
echo $form->labelEx($model, 'id_method');
$val = '';
if (isset($model->id_method)) {
$val = Method::model()->findByPk($model->id_method)->signature_name();
}
echo $this->autoComplete('UnitTest[id_method]', 'class/methodComplete', $model->id_method, $val);
echo $form->error($model, 'id_method');
?>
</div>