本文整理汇总了PHP中Controller::loadModel方法的典型用法代码示例。如果您正苦于以下问题:PHP Controller::loadModel方法的具体用法?PHP Controller::loadModel怎么用?PHP Controller::loadModel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Controller
的用法示例。
在下文中一共展示了Controller::loadModel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initialize
/**
* Called before the Controller::beforeFilter().
*
* @param $controller
* @return void
*/
public function initialize($controller)
{
parent::initialize($controller);
$this->LightOpenID = new LightOpenID(env('SERVER_NAME'));
$this->Controller =& $controller;
$this->Controller->loadModel('AuthService.OpenidUser');
$this->Controller->loadModel('User');
}
示例2: _loadExistingController
/**
* Load an existing controller if there IS a GET parameter passed
*
* @return boolean|string
*/
private function _loadExistingController()
{
$file = $this->_controllerPath . $this->_url[0] . '.php';
if (file_exists($file)) {
/** @noinspection PhpIncludeInspection */
require_once $file;
$this->_controller = new $this->_url[0]();
$this->_controller->loadModel(ucfirst($this->_url[0]), null, $this->_modelPath);
return true;
} else {
$this->_loadDefaultController();
return false;
}
}
示例3: useModel
/**
* Sets the model class to be used during the action execution.
*
* @param string $modelName The name of the model to load.
* @return void
*/
public function useModel($modelName)
{
$this->_controller->loadModel($modelName);
list(, $modelName) = pluginSplit($modelName);
$this->_model = $this->_controller->{$modelName};
$this->_modelName = $this->_model->name;
}
示例4: assignperms
function assignperms()
{
Controller::loadModel('Group');
$acl =& $this->Acl;
$group =& $this->Group;
$group->id = 1;
$acl->allow($group, 'controllers');
$group->id = 3;
$acl->deny($group, 'controllers');
$acl->allow($group, 'pages/display');
$acl->allow($group, 'Stats/index');
$acl->allow($group, 'Users/login');
$acl->allow($group, 'Users/logout');
$acl->allow($group, 'Users/register');
$acl->allow($group, 'Users/get_friends');
$acl->allow($group, 'Users/get_friend_activity');
$acl->allow($group, 'Users/get_shows');
$acl->allow($group, 'Users/get_upcoming_episodes');
$acl->allow($group, 'Users/home');
$acl->allow($group, 'Users/change_settings');
$acl->allow($group, 'Shows/follow');
$acl->allow($group, 'Shows/all');
$acl->allow($group, 'Shows/all_untracked');
$acl->allow($group, 'Shows/search');
$acl->allow($group, 'Shows/index');
$acl->allow($group, 'Shows/unfollow');
$acl->allow($group, 'Shows/get_next_airing');
$acl->allow($group, 'Shows/get_last_airing');
$acl->allow($group, 'Shows/view');
$acl->allow($group, 'Shows/view_info');
$this->set('success', 'Success!');
}
示例5: admin_set_payment_status
public function admin_set_payment_status()
{
//pr($_POST);die;
$this->layout = '';
$premiumRequestId = $_POST['request_id'];
$preReqArr = $this->PremiumRequest->findById($premiumRequestId);
if (!empty($preReqArr)) {
//1. Change the request section in business table
Controller::loadModel('Business');
$saveBusinessData['id'] = $preReqArr['PremiumRequest']['business_id'];
$saveBusinessData['request_sent'] = $preReqArr['PremiumRequest']['user_id'];
if ($this->Business->save($saveBusinessData, false)) {
//2. set the status in the premium request table
$saveRequest['id'] = $preReqArr['PremiumRequest']['id'];
$saveRequest['status'] = '2';
$this->PremiumRequest->save($saveRequest, false);
}
//send email to the corresponding user start
$this->set('preReqArr', $preReqArr);
$this->Email->to = $preReqArr['User']['email'];
$this->Email->from = EMAIL_ADMIN_FROM;
$this->Email->subject = 'Your request for Plan Upgrade';
$this->Email->template = 'admin/plan_upgrade';
$this->Email->sendAs = 'html';
$this->Email->send();
//send email to the corresponding user end
}
echo '<font color="green">Sent!!</font>';
exit;
}
示例6: initialize
public function initialize(Controller $controller)
{
//load required for component models
if ($this->uses !== false) {
foreach ($this->uses as $modelClass) {
$controller->loadModel($modelClass);
$this->{$modelClass} = $controller->{$modelClass};
}
}
}
示例7: saveIpDetails
function saveIpDetails($ip)
{
Controller::loadModel('IpAddress');
$ret = '';
$ipDetailsArr = $this->getAllLocationDetails();
if (!empty($ipDetailsArr) && $ipDetailsArr['statusCode'] == 'OK' && $ipDetailsArr['countryCode'] != '-') {
$ipDetailsArr['ipAddress'] = $ip;
$this->IpAddress->save($ipDetailsArr, false);
$ipDetailsArr['id'] = $this->IpAddress->id;
$ret = $ipDetailsArr;
}
return $ret;
}
示例8: auto_data
function auto_data()
{
Controller::loadModel('User');
$this->layout = 'ajax';
$searchkey = trim($_POST['searchkey']);
$return = '';
$searchArr = $this->User->find('all', array('conditions' => array('User.id <>' => $this->Session->read('Auth.User.User.id'), 'User.status' => '1', 'OR' => array('User.first_name LIKE' => "%" . $searchkey . "%", 'User.last_name LIKE' => "%" . $searchkey . "%", 'CONCAT(User.first_name, " ", User.last_name) LIKE' => "%" . $searchkey . "%", 'User.email LIKE' => "%" . $searchkey . "%"))));
$this->set('searchArr', $searchArr);
if (!empty($searchArr)) {
$return = $searchArr;
}
return $return;
}
示例9: addFeedsInBusinessFeeds
public function addFeedsInBusinessFeeds($id, $type)
{
Controller::loadModel('BusinessFeed');
$saveData['user_id'] = $this->Session->read('Auth.User.User.id');
$saveData['recommend'] = '1';
$saveData['recommend_type'] = $type;
if ($type == 'Business') {
$saveData['business_id'] = $id;
} else {
$saveData['recommend_feed_id'] = $id;
}
$this->BusinessFeed->save($saveData);
}
示例10: subscribe_business
public function subscribe_business(){ //pr($_POST);die;
$this->layout = 'ajax';
Controller::loadModel('Favorite');
$this->BusinessSubscriber->recursive = -1;
$subscribeArr = $this->BusinessSubscriber->find('first', array('conditions'=>array('BusinessSubscriber.business_id'=>$_POST['business_id'], 'BusinessSubscriber.user_id'=>$this->Session->read('Auth.User.User.id'), 'BusinessSubscriber.status'=>'1')));
$this->Favorite->recursive = -1;
$favoriteArr = $this->Favorite->find('first', array('conditions'=>array('Favorite.business_id'=>$_POST['business_id'], 'Favorite.user_id'=>$this->Session->read('Auth.User.User.id'), 'Favorite.status'=>'1')));
if($_POST['type'] == 'subscribe'){ //subscribe business
if(empty($subscribeArr)){
$saveData['business_id'] = $_POST['business_id'];
$saveData['user_id'] = $this->Session->read('Auth.User.User.id');
$saveData['status'] = '1';
if($this->BusinessSubscriber->save($saveData)){
$ret = 'subscribed';
//add to favorite list as well
if(empty($favoriteArr)){
$saveFavData['user_id'] = $this->Session->read('Auth.User.User.id');
$saveFavData['business_id'] = $_POST['business_id'];
$saveFavData['status'] = '1';
$this->Favorite->save($saveFavData);
}
}else
$ret = 'Please Try Later!!';
}else
$ret = 'Business Already Subscribed!!';
}else{ //unsubscribe business
if(!empty($subscribeArr)){
if($this->BusinessSubscriber->delete($subscribeArr['BusinessSubscriber']['id'])){
$ret = 'unsubscribed';
//remove from the favorite list
if(!empty($favoriteArr)){
$this->Favorite->delete($favoriteArr['Favorite']['id']);
}
}else
$ret = 'Please Try Later!!';
}else
$ret = 'No Subscribed Business Found!!';
}
$this->set('ret', $ret);
$this->set('post', $_POST);
}
示例11: beforeFilter
function beforeFilter()
{
parent::loadModel('Option');
//$this->Auth->allow('*');
$this->Auth->loginError = 'Invalid combination of username and password!';
$this->Auth->loginRedirect = array('controller' => 'dashboards', 'action' => 'admin_home');
$this->Auth->logoutRedirect = array('controller' => 'users', 'action' => 'admin_login');
$this->Auth->loginAction = array('admin' => true, 'controller' => 'users', 'action' => 'admin_login');
$is_logged_in = $this->_isLoggedIn();
$username = $this->_getUsername();
// Load Theme
$this->theme = $this->Option->getOption('theme');
$this->set(compact('is_logged_in', 'username'));
}
示例12: send_confirmation_mail
function send_confirmation_mail($to, $firstName, $lastName, $quantity)
{
$content = "Hallo " . $firstName . ",\r\n";
$content .= "\r\n";
$content .= "Wir haben den Unkostenbeitrag erhalten.\r\n";
$content .= "Name auf der Gästeliste: " . $firstName . " " . $lastName . "\r\n";
$content .= "Anzahl Personen: " . $quantity . "\r\n";
$content .= "\r\n";
$content .= "Vielen Dank. Wir sehen uns bei Media Meets People!\r\n";
$content .= "Das Team des Multimediale Jugendarbeit Sachsen e.V.\r\n";
better_mail($to, 'Unkostenbeitrag erhalten - Media Meets People', $content);
require './application/config/config.php';
require './application/libs/controller.php';
$tmp = new Controller();
$mmpt_ticket_model = $tmp->loadModel('mmpTicketModel');
$mmpt_ticket_model->addTicket($to, $firstName, $lastName, $quantity);
}
示例13: validateWebsiteUser
public function validateWebsiteUser($email){
Controller::loadModel('User');
$ret = 'false';
if($email != ''){
$userCount = $this->User->find('count', array('conditions'=>array('User.email'=>$email)));
if($userCount > 0)
$ret = 'true';
else{
$inviteCount = $this->Invite->find('count', array('conditions'=>array('Invite.invitee_email'=>$email)));
if($inviteCount > 0)
$ret = 'true';
}
}
return $ret;
}
示例14: Accept
public function Accept($username)
{
$user = $this->User->find('first', array('conditions' => array('User.username' => $this->request->params['username'])));
if (!$user) {
$this->Session->setFlash('That user could not be found', 'default', array('class' => 'alert alert-info'), 'info');
return $this->redirect(array('controller' => 'homes', 'action' => 'index'));
}
if (!$this->User->AcceptfriendRequest($user)) {
return $this->redirect(array('controller' => 'homes', 'action' => 'index'));
}
$id_accept = $this->User->Friend->find('first', array('conditions' => array("user_id" => $this->Auth->user('id'), "friend_id" => $user['User']['id'], "accepted" => FALSE)));
$this->User->Friend->create();
$data = array("user_id" => $this->Auth->user('id'), "friend_id" => $user['User']['id'], "accepted" => TRUE, "id" => $id_accept['Friend']['id']);
Controller::loadModel('User');
$this->User->Friend->save($data);
$this->Session->setFlash('Friend request accepted', 'default', array('class' => 'alert alert-info'), 'info');
return $this->redirect(array('controller' => 'Profile', 'action' => 'Profile', 'username' => $user['User']['username']));
}
示例15: __construct
function __construct()
{
Controller::loadModel('PaypalSetting');
$paymentArr = $this->PaypalSetting->find('first', array('conditions' => array('PaypalSetting.status' => '1')));
if ($paymentArr['PaypalSetting']['mode_type'] == 'Testing') {
$settingId = 1;
$environment = 'sandbox';
} else {
$settingId = 2;
$environment = 'live';
}
$paypalSettingsArr = $this->PaypalSetting->find('first', array('conditions' => array('PaypalSetting.id' => $settingId)));
$this->API_USERNAME = urlencode($paypalSettingsArr['PaypalSetting']['user_name']);
$this->API_PASSWORD = urlencode($paypalSettingsArr['PaypalSetting']['password']);
$this->API_SIGNATURE = urlencode($paypalSettingsArr['PaypalSetting']['signature']);
$this->API_ENDPOINT = "https://api-3t.paypal.com/nvp";
if ('sandbox' === $environment || 'beta-sandbox' === $environment) {
$this->API_ENDPOINT = 'https://api-3t.' . $environment . '.paypal.com/nvp';
}
}