本文整理汇总了PHP中Store::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Store::model方法的具体用法?PHP Store::model怎么用?PHP Store::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Store
的用法示例。
在下文中一共展示了Store::model方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addEvent
private function addEvent($type, $id, $email, $datetime)
{
echo 'Adding ' . strtoupper($type) . ' to campaign ' . $id . ' with date of ' . $datetime . ' and email of ' . $email . "\r\n";
$StoreModel = new Store();
$encryptedEmail = $StoreModel->encryptEmail($email);
// Look for this email address in store table
$StoreRows = Store::model()->with('store2contact')->findAll(array('condition' => 'email = :email', 'params' => array(':email' => $encryptedEmail)));
// collect our warehouse_ids up to match in campaign_contact table.
$warehouseIDs = [];
if (sizeof($StoreRows)) {
// Save 1 suppression row for every instance of the email address in the store table - use store_id
foreach ($StoreRows as $Store) {
if ($Store->store2contact != null) {
$warehouseIDs[] = $Store->store2contact->contact_warehouse_id;
}
}
$Contacts = null;
// check for contact
if (sizeof($warehouseIDs) && is_numeric($id)) {
//Bounces
if ($type === 'bounce') {
$Contacts = CampaignContact::model()->updateAll(array('bounced' => $datetime), "campaign_id = :campaign_id AND warehouse_id IN (" . implode(',', $warehouseIDs) . ") AND bounced IS NULL", array(':campaign_id' => $id));
} else {
$Contacts = CampaignContact::model()->updateAll(array('opened' => $datetime), "campaign_id = :campaign_id AND warehouse_id IN (" . implode(',', $warehouseIDs) . ") AND opened IS NULL", array(':campaign_id' => $id));
}
}
echo 'Updated ' . sizeof($Contacts) . ' contact';
} else {
echo 'Campaign contact not found' . "\r\n";
}
echo "\r\n";
}
示例2: authenticate
/**
* Authenticates a user.
* The example implementation makes sure if the username and password
* are both 'demo'.
* In practical applications, this should be changed to authenticate
* against some persistent user identity storage (e.g. database).
* @return boolean whether authentication succeeds.
*/
public function authenticate()
{
$result = Managers::model()->find('name=? and is_quit=?', array($this->username, "0"));
if ($result) {
if ($result->password == md5($this->username . md5($this->password))) {
$this->_id = $result->id;
$this->errorCode = self::ERROR_NONE;
$token = md5($result->id . $this->password);
//Yii::app()->cache_redis->set($result->id.'.UserToken',$token);
$store = Store::model()->findAll('manager=:id', array(':id' => $result->id));
$store_ids = array();
if ($store) {
foreach ($store as $key => $val) {
$store_ids[] = $val->id;
}
}
Yii::app()->user->setState('token', $token);
Yii::app()->user->setState('info', $result);
Yii::app()->user->setState('store', $store);
Yii::app()->user->setState('store_ids', $store_ids);
} else {
$this->errorCode = self::ERROR_PASSWORD_INVALID;
}
} else {
$this->errorCode = self::ERROR_USERNAME_INVALID;
}
return !$this->errorCode;
}
示例3: run
public function run($args)
{
exit('Disabled');
$Stores = Store::model()->with('organisation')->findAll();
foreach ($Stores as $Store) {
if (strlen($Store->email)) {
print $Store->first_name . ',' . $Store->last_name . ',' . $Store->email . ',' . $Store->organisation->title . ',' . $this->getEmailPrefs($Store->contact_email) . "\r\n";
//print $Store->last_name . "\n";
//print $Store->address_line_1 . "\n\n\n";
//print $Store->phone . "\n\n\n";
//print $Store->mobile . "\n\n\n";
}
}
exit;
/*
$StoreModel = new Store;
$email = $StoreModel->encryptEmail($email);
$Store = Store::model()->findAll(array(
'condition' => 'email = :email',
'params' => array(
':email' => $email,
),
));
print_r($Store);
*/
}
示例4: actionAutocomplete
public function actionAutocomplete($query)
{
$json = array(array('id' => 0, 'value' => Yii::t('store', 'Default')));
$stores = Store::model()->findAll("name LIKE '%{$query}%' ");
foreach ($stores as $store) {
$json[] = array('id' => $store->category_id, 'value' => $store->name);
}
echo CJSON::encode($json);
}
示例5: actionIndex
/**
* This is the default 'index' action that is invoked
* when an action is not explicitly requested by users.
*/
public function actionIndex()
{
$this->pageTitle = "POSnail";
$data = array();
if (Yii::app()->user->parts == 2) {
$service = new Service('search');
$customer = new Customer('search');
$employee = new User('search');
$model = Store::model()->find('pk_s_id = :pk_s_id', array(':pk_s_id' => Yii::app()->user->storeID));
$data = array('model' => $model, 'customer' => $customer, 'employee' => $employee, 'service' => $service);
}
$this->render($this->view . 'index', $data);
}
示例6: actionIndex
public function actionIndex()
{
$model = new ConsumerLog('search');
$model->unsetAttributes();
$amount = ConsumerLog::model()->getAmount();
if ($_GET['ConsumerLog']) {
$model->attributes = $_GET['ConsumerLog'];
/* var_dump($_GET);
exit;*/
$amount = ConsumerLog::model()->getAmount($_GET['ConsumerLog']);
}
$names = Store::model()->getName();
$this->render('index', ['model' => $model, 'names' => $names, 'amount' => $amount]);
}
示例7: run
public function run($args)
{
exit('Disabled');
$StoreRows = Store::model()->findAll(array('condition' => "salutation IN ('0','1','2','3','4','5')"));
$salutations = array(0 => 'Mr', 1 => 'Mrs', 2 => 'Ms', 3 => 'Miss', 4 => 'Dr', 5 => 'Prof');
$fixed = 0;
foreach ($StoreRows as $Store) {
$wrongSalutation = $Store->salutation;
$Store->salutation = $salutations[$wrongSalutation];
if ($Store->save(true, array('salutation'))) {
$fixed++;
}
print 'Fixed salutation from ' . $wrongSalutation . ' to ' . $Store->salutation . "\n";
}
print "\n\n" . 'fixed ' . $fixed . ' of ' . count($StoreRows) . " store rows \n\n";
}
示例8: actionUpdate
public function actionUpdate($id)
{
$model = new CategoryForm();
if (isset($_POST['CategoryForm'])) {
$model->attributes = $_POST['CategoryForm'];
if ($model->validate()) {
$model->save();
$this->redirect(array('index'));
}
} else {
$model->loadDataFromCategory($id);
}
$statuses = array(0 => Yii::t('common', 'Disabled'), 1 => Yii::t('common', 'Enabled'));
$stores = CHtml::listData(Store::model()->findAll(), 'store_id', 'name');
$stores[0] = Yii::t('store', 'Default');
$this->render('update', array('model' => $model, 'stores' => $stores, 'statuses' => $statuses));
}
示例9: authenticate
/**
* Authenticates a user.
* The example implementation makes sure if the username and password
* are both 'demo'.
* In practical applications, this should be changed to authenticate
* against some persistent user identity storage (e.g. database).
* @return boolean whether authentication succeeds.
*/
public function authenticate()
{
if (strpos($this->username, "@")) {
$user = User::model()->notsafe()->findByAttributes(array('email' => $this->username));
} else {
$user = User::model()->notsafe()->findByAttributes(array('username' => $this->username));
}
if ($_SESSION['store']['store_id']) {
$store = Store::model()->findByPk($_SESSION['store']['store_id']);
}
if ($user === null) {
if (strpos($this->username, "@")) {
$this->errorCode = self::ERROR_EMAIL_INVALID;
} else {
$this->errorCode = self::ERROR_USERNAME_INVALID;
}
} else {
if (Yii::app()->getModule('user')->encrypting($this->password) !== $user->password) {
$this->errorCode = self::ERROR_PASSWORD_INVALID;
} else {
if ($user->status == 0 && Yii::app()->getModule('user')->loginNotActiv == false) {
$this->errorCode = self::ERROR_STATUS_NOTACTIV;
} else {
if ($user->status == -1) {
$this->errorCode = self::ERROR_STATUS_BAN;
} else {
if ($user->superuser == 0) {
$this->errorCode = self::ERROR_STATUS_NOTADMIN;
} else {
if ($store->user_id !== $user->id) {
$this->errorCode = self::ERROR_STATUS_NOTOWNER;
} else {
$this->_id = $user->id;
$this->username = $user->username;
$this->errorCode = self::ERROR_NONE;
}
}
}
}
}
}
return !$this->errorCode;
}
示例10: init
public function init()
{
parent::init();
$host = Yii::app()->request->hostInfo;
$domain = str_replace('http://', '', $host);
if ($host == 'http://' . F::sg('site', 'shopDomain')) {
Yii::app()->theme = 'store';
} else {
$store = Store::model()->findByAttributes(array('domain' => $domain));
$session = new CHttpSession();
$session->open();
// $session->destroy();
$session['store'] = array('store_id' => $store->store_id, 'name' => $store->name, 'email' => $store->email, 'theme' => $store->theme);
// $store_name = $session['store']; // get session variable 'name1'
// foreach ($session as $name => $value) // traverse all session variables
// $session['name3'] = $value3; // set session variable 'name3'
// echo $store->domain;
// exit;
Yii::app()->theme = $store->theme;
// print_r($_SESSION);
}
// exit;
}
示例11: authenticate
public function authenticate()
{
// Try to get user from User table - this will be an administrator
$User = User::model()->findByAttributes(array('email' => strtolower($this->username), 'verified' => 1, 'mothballed' => 0));
if (!is_null($User)) {
// We have an admin user
if (isset($User->password)) {
if ($User->password === hash('sha256', $this->password . SHASALT)) {
$this->errorCode = self::ERROR_NONE;
$this->_id = $User->id;
$this->userType = 'admin';
} else {
$this->errorCode = self::ERROR_PASSWORD_INVALID;
}
}
} else {
// For encryption
$Store = new Store();
$Criteria = new CDbCriteria();
$Criteria->condition = "\n\t\t\t\temail = :email AND \n\t\t\t\torigin_organisation_id = :origin_organisation_id AND \n\t\t\t\tpassword IS NOT NULL \n\t\t\t";
$Criteria->params = array(':email' => $Store->encryptEmail($this->username), ':origin_organisation_id' => 10);
$Store = Store::model()->with('store2contact', 'store2contact.accession')->find($Criteria);
if (!is_null($Store)) {
// We have a user from THE LIST
// Does the password match?
if ($Store->store2contact->accession->password === hash('sha256', $this->password . SHASALT)) {
$this->errorCode = self::ERROR_NONE;
$this->_id = $Store->id;
$this->userType = 'contact';
} else {
$this->errorCode = self::ERROR_PASSWORD_INVALID;
}
}
}
return !$this->errorCode;
}
示例12: actionIndex
public function actionIndex()
{
$stores = Store::model()->findAll();
$this->render('index', array('stores' => $stores));
}
示例13: array
<?php
$this->breadcrumbs[] = Yii::t('crud', 'Inventories');
Yii::app()->clientScript->registerScript('search', "\n \$('.search-button').click(function(){\n \$('.search-form').toggle();\n return false;\n });\n \$('.search-form form').submit(function(){\n \$.fn.yiiGridView.update(\n 'inventory-grid',\n {data: \$(this).serialize()}\n );\n return false;\n });\n ");
?>
<?php
$this->widget("TbBreadcrumbs", array("links" => $this->breadcrumbs));
?>
<h1>
<?php
echo Yii::t('crud', 'Inventories');
?>
<small><?php
echo Yii::t('crud', 'Manage');
?>
</small>
</h1>
<?php
$this->renderPartial("_toolbar", array("model" => $model));
?>
<?php
$this->widget('TbGridView', array('id' => 'inventory-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'template' => '{pager}{items}{pager}{summary}', 'pager' => array('class' => 'TbPager', 'displayFirstAndLast' => true), 'columns' => array(array('class' => 'CLinkColumn', 'header' => '', 'labelExpression' => '$data->itemLabel', 'urlExpression' => 'Yii::app()->controller->createUrl("view", array("inventory_id" => $data["inventory_id"]))'), array('class' => 'editable.EditableColumn', 'name' => 'inventory_id', 'editable' => array('url' => $this->createUrl('/sakila/slim/inventory/editableSaver'))), array('name' => 'film_id', 'value' => 'CHtml::value($data,\'film.itemLabel\')', 'filter' => CHtml::listData(Film::model()->findAll(array('limit' => 1000)), 'film_id', 'itemLabel')), array('name' => 'store_id', 'value' => 'CHtml::value($data,\'store.itemLabel\')', 'filter' => CHtml::listData(Store::model()->findAll(array('limit' => 1000)), 'store_id', 'itemLabel')), array('class' => 'editable.EditableColumn', 'name' => 'last_update', 'editable' => array('url' => $this->createUrl('/sakila/slim/inventory/editableSaver'))), array('class' => 'TbButtonColumn', 'viewButtonUrl' => 'Yii::app()->controller->createUrl("view", array("inventory_id" => $data->inventory_id))', 'updateButtonUrl' => 'Yii::app()->controller->createUrl("update", array("inventory_id" => $data->inventory_id))', 'deleteButtonUrl' => 'Yii::app()->controller->createUrl("delete", array("inventory_id" => $data->inventory_id))'))));
示例14: actionOpen
public function actionOpen()
{
// See http://documentation.mailgun.com/user_manual.html#webhooks
// Mail so we know we have received the opened webhook
// Set up authorisation
$authString = $_POST['timestamp'] . $_POST['token'];
$authHash = hash_hmac('sha256', $authString, Yii::app()->params['mailgun']['key']);
// Check Auth
if ($authHash === $_POST['signature']) {
// Huzzah! Authorized HTTP POST from Mailgun
$uniques = array();
$StoreModel = new Store();
// Encrypt the email so we can find a match
$openedEmailAddress = $StoreModel->encryptEmail($_POST['recipient']);
// Look for this email address in store table
$StoreRows = Store::model()->with('store2contact')->findAll(array('condition' => 'email = :email', 'params' => array(':email' => $openedEmailAddress)));
// collect our warehouse_ids up to match in campaign_contact table.
$warehouseIDs = [];
if (sizeof($StoreRows)) {
// Save 1 suppression row for every instance of the email address in the store table - use store_id
foreach ($StoreRows as $Store) {
// expired? No store to contact. Skip
if (!is_null($Store->store2contact)) {
$warehouseIDs[] = $Store->store2contact->contact_warehouse_id;
}
}
// check for campaign_contacts.
if (sizeof($warehouseIDs) && is_numeric($_POST['campaign_id']) && is_numeric($_POST['group_id'])) {
// it's a bounce of a campaign email. Mark against the row.
CampaignContact::model()->updateAll(array('opened' => date('Y-m-d H:i:s', $_POST['timestamp'])), "campaign_id = :campaign_id AND group_id = :group_id AND warehouse_id IN (" . implode(',', array_filter($warehouseIDs)) . ") AND opened IS NULL", array(':campaign_id' => $_POST['campaign_id'], ':group_id' => $_POST['group_id']));
}
header("HTTP/1.0 200 Ok");
exit;
} else {
header("HTTP/1.0 404 Not Found");
exit('Not Found');
}
} else {
// Go away
sleep(5);
header("HTTP/1.0 401 Unauthorized");
exit('Unauthorized');
}
}
示例15: import
//.........这里部分代码省略.........
if(this row (int)CCR_Ind_Set matches a ccr_duplicate_id with the same organisation_id){
// mega dupe
if( existing record has 'Yes' for CCR_Ind_Dupe1 ){
insert and expire this row
}
else
{
expire existing
insert this row
}
}
else
{
// no other rows in same org
insert this row
}
}
else
{
// not a duplicate
}
*/
// is this the ccr dupe favoured row?
$StoreView['ccr_ind_dupe1'] = trim($data['CCR_Ind_Dupe1']) === 'Yes' ? 1 : 0;
// If CCR has detected a duplicate...
if ($data['CCR_Ind_Set'] > 0) {
$this->totalDupes++;
$StoreView->ccr_duplicate_id = $data['CCR_Ind_Set'];
//print "CCR_Ind_Set > 0\n";
//first of all, let see if the dupe has the same origin id as a previous in the database
$DupeMatches = Store::model()->with(array('store2contact'))->findAllByAttributes(array('ccr_duplicate_id' => $data['CCR_Ind_Set'], 'date_expired' => null), array('index' => 'origin_organisation_id'));
// print ('starting new loop with dupes');
if (sizeof($DupeMatches)) {
// print "size DupeMatches > 0\n";
$Store2Contact = null;
// print_r(array_keys($DupeMatches));
// print "\nDupeMatch orgs: " . $organisation_id . "\n";
if (array_key_exists((int) $organisation_id, $DupeMatches)) {
// we have a match from the same organisation
// print "org exists in dupes data\n";
//not do in the correct order, needs to be done with CCR_Ind_Set
//we need to expire the match and update the warehouse record
//we the new one
//echo 'DupeMatch';
if ($DupeMatches[$organisation_id]->ccr_ind_dupe1) {
// print "Alread have trusted row, expire row\n";
// already have a trusted row. Expire and insert this one.
$StoreView->date_expired = date('Y-m-d H:i:s');
$StoreView->ccr_ind_dupe1 = 0;
// just in case.
} else {
// print "Update store row\n";
// update store row
$DupeMatches[$organisation_id]->date_expired = date('Y-m-d H:i:s');
$DupeMatches[$organisation_id]->save();
// update any suppression list rows to not have warehouse or store_id. They're old and expired.
SuppressionList::model()->deleteAll('store2contact_id = ' . (int) $DupeMatches[$organisation_id]->store2contact->id);
// clone the contact_warehouse_id and ind set. Gets saved below.
$Store2Contact = $DupeMatches[$organisation_id]->store2contact;
// print 'Store2Contact=';
// print_r ($Store2Contact->attributes);
$Store2Contact->contact_warehouse_id = $DupeMatches[$organisation_id]->store2contact->contact_warehouse_id;
}