public function init() { //'itemTable'=>'AuthItem', //'itemChildTable'=>'AuthItemChild', $this->assignmentTable = Campaign::getId() . '_AuthAssignment'; parent::init(); }
public function init() { // --- campaign $c_id = Campaign::getId(); if ($c_id) { $folder = '/uploads/c' . $c_id . '/parts/'; } else { $folder = '/uploads/additions/'; } // --- $this->arrDataProvider = new CArrayDataProvider(ZakazParts::model()->with('files')->findAllByAttributes(['proj_id' => $this->projectId])); if (!file_exists(Yii::getPathOfAlias('webroot') . $folder)) { mkdir(Yii::getPathOfAlias('webroot') . $folder, 0777, true); } if (!file_exists(Yii::getPathOfAlias('webroot') . $folder . 'temp/')) { mkdir(Yii::getPathOfAlias('webroot') . $folder . 'temp/', 0777); } if (!User::model()->isCustomer()) { foreach (array_diff(scandir(Yii::getPathOfAlias('webroot') . $folder . 'temp/'), array('..', '.')) as $k => $v) { $temps[array_reverse(str_getcsv(pathinfo($v, PATHINFO_FILENAME), '_'))[0]][$k] = array('id' => 0, 'part_id' => array_reverse(str_getcsv(pathinfo($v, PATHINFO_FILENAME), '_'))[0], 'orig_name' => implode('_', array_slice(str_getcsv(pathinfo($v, PATHINFO_FILENAME), '_'), 0, -1)) . '.' . pathinfo($v, PATHINFO_EXTENSION), 'file_name' => Yii::app()->baseUrl . $folder . 'temp/' . $v, 'comment' => 0, 'for_approved' => 'Must approved'); } } $tempdata = $this->arrDataProvider->getData(); foreach ($tempdata as $k => $v) { if (isset($tempdata[$k]->files)) { foreach ($tempdata[$k]->files as $fk => $fv) { $tempdata[$k]->files[$fk]->file_name = Yii::app()->baseUrl . $folder . $fv->part_id . '/' . $fv->file_name; } } if (isset($temps[$v->id])) { $tempdata[$k]->files = array_merge($v->files, $temps[$v->id]); } } $this->arrDataProvider->setData($tempdata); }
/** * * @param Campaign $campaign * @param bool $fetch_user * @return Doctrine_Query */ public function queryByCampaign(Campaign $campaign, $fetch_user = true) { $query = $this->createQuery('cr')->where('cr.campaign_id = ?', $campaign->getId()); if ($fetch_user) { $query->leftJoin('cr.User u')->addSelect('cr.*, u.*'); } return $query; }
public function init() { $c_id = Campaign::getId(); if ($c_id) { self::$folder = '/uploads/c' . $c_id . '/payments/'; } else { self::$folder = '/uploads/payments/'; } }
public function tableName() { $c_id = Campaign::getId(); if ($c_id) { return $c_id . '_Projects'; } else { return 'Projects'; } }
public function tableName() { $c_id = Campaign::getId(); if ($c_id) { return $c_id . '_' . Yii::app()->getModule('user')->tableProfiles; } else { return Yii::app()->getModule('user')->tableProfiles; } }
public function folder() { // --- campaign $c_id = Campaign::getId(); if ($c_id) { return '/uploads/c' . $c_id . '/parts/'; } else { return '/uploads/additions/'; } }
public function actionApiView() { $c_id = Campaign::getId(); $table_prefix = ''; if ($c_id) { $table_prefix = $c_id . '_'; } $user = User::model()->findByPk(Yii::app()->user->id); if (!$user->superuser) { $this->redirect('/'); } else { $this->_prepairJson(); $sort = $this->_request->getParam('sort'); $type = $this->_request->getParam('type'); $searchField = $this->_request->getParam('search_field'); $searchType = $this->_request->getParam('search_type'); $searchString = $this->_request->getParam('search_string'); if (!$sort) { $sort = 'receive_date'; } if (!$type) { $type = 'DESC'; } if ($searchField == '' || $searchString == '' || $searchType == '') { $sql = 'SELECT * FROM `' . $table_prefix . 'Payment` ORDER BY `' . $sort . '` ' . $type . ' ; '; } else { switch ($searchType) { case 'bigger': $searchType = '<'; break; case 'smaller': $searchType = '>'; break; case 'equal': $searchType = '='; break; } $sql = 'SELECT * FROM `' . $table_prefix . 'Payment` WHERE `' . $searchField . '` ' . $searchType . ' ' . $searchString . ' ORDER BY `' . $sort . '` ' . $type . ' ; '; } $data = Payment::model()->findAllBySql($sql); $report = array(); $report['summary'] = 0; $report['ids_count'] = 0; foreach ($data as $row) { $report['ids_count']++; if ($row->payment_type == 0) { $report['summary'] = $report['summary'] + $row->summ; } else { $report['summary'] = $report['summary'] - $row->summ; } } $this->_response->setData(array('data' => $data, 'report' => $report)); $this->_response->send(); } }
protected function getTableName() { //$campaign = Campaign::search_by_domain($_SERVER['SERVER_NAME']); $c_id = Campaign::getId(); if ($c_id) { return $c_id . '_ProjectMessages'; } else { return 'ProjectMessages'; } //return "ProjectMessages"; }
/** * * @param Campaign $campaign * @return Doctrine_Query */ public function queryByCampaign(Campaign $campaign, $active_only = false, $deleted_too = false) { $query = $this->createQuery('ml')->orderBy('ml.id')->where('ml.campaign_id = ?', $campaign->getId()); if ($active_only) { $query->andWhere('ml.status = ?', MailingListTable::STATUS_ACTIVE); } else { if (!$deleted_too) { $query->andWhere('ml.status != ?', MailingListTable::STATUS_DELETED); } } return $query; }
/** * @return string the associated database table name */ public function tableName() { $id = Campaign::getId(); /* echo 'id='.$id; if (strpos(Yii::app()->user->guestName,'Guest')!==false){ $this->getCampaignNumber(); $id = Campaign::getId(); echo ' id(1)='.$id; }; */ return $id . '_Сatalog'; }
public function tableName() { $c_id = Campaign::getId(); if ($c_id) { return $c_id . '_ProjectMessages'; } else { return 'ProjectMessages'; } /*if(isset(self::$table_prefix)) return self::$table_prefix.'ProjectMessages'; else return 'ProjectMessages';*/ }
public function init() { // --- Организации $c_id = Campaign::getId(); if ($c_id) { Payment::$table_prefix = $c_id . '_'; //Profile::$table_prefix = $c_id.'_'; //ProfileField::$table_prefix = $c_id.'_'; ProjectChanges::$table_prefix = $c_id . '_'; ProjectChanges::$file_path = 'uploads/c' . $c_id . '/changes_documents'; //ProjectMessages::$table_prefix = $c_id.'_'; ProjectPayments::$table_prefix = $c_id . '_'; Zakaz::$table_prefix = $c_id . '_'; Zakaz::$files_folder = '/uploads/c' . $c_id . '/'; Events::$table_prefix = $c_id . '_'; ZakazParts::$table_prefix = $c_id . '_'; UpdateProfile::$table_prefix = $c_id . '_'; ZakazPartsFiles::$table_prefix = $c_id . '_'; PaymentImage::$table_prefix = $c_id . '_'; Emails::$table_prefix = $c_id . '_'; Yii::app()->language = Campaign::getLanguage(); } else { ProjectChanges::$file_path = 'uploads/changes_documents'; } // --- if (!Yii::app()->user->isGuest) { switch (User::model()->getUserRole()) { case 'Manager': case 'Admin': Yii::app()->theme = 'admin'; break; case 'Author': $this->menu = array(array('label' => Yii::t('site', 'My orders'), 'url' => array('/project/zakaz/ownList')), array('label' => Yii::t('site', 'New projects'), 'url' => array('/project/zakaz/list')), array('label' => Yii::t('site', 'Profile'), 'url' => array('/user/profile/edit')), array('label' => Yii::t('site', 'Logout'), 'url' => array('/user/logout'))); $this->authMenu = array(array('label' => Yii::t('site', 'Logout'), 'url' => array('/user/logout'))); Yii::app()->theme = 'client'; break; case 'Customer': $this->menu = array(array('label' => Yii::t('site', 'My orders'), 'url' => array('/project/zakaz/customerOrderList')), array('label' => Yii::t('site', 'Create order'), 'url' => array('/project/zakaz/create')), array('label' => Yii::t('site', 'Profile'), 'url' => array('/user/profile/edit')), array('label' => Yii::t('site', 'Logout'), 'url' => array('/user/logout'))); $this->authMenu = array(array('label' => Yii::t('site', 'Logout'), 'url' => array('/user/logout'))); Yii::app()->theme = 'client'; break; } } // var_dump(Yii::app()->controller->module->id ,Yii::app()->controller->id, Yii::app()->controller->action->id); // die(); }
public static function getNamesByIds($ids, $delimiter = null) { if (!is_array($ids)) { $ids = explode(',', $ids); } $cats = Yii::app()->db->createCommand()->select('cat_name')->from(Campaign::getId() . '_Сatalog')->where(array('in', 'id', $ids))->queryAll(); if (!($delimiter === null)) { foreach ($cats as $item) { $names .= $item['cat_name'] . $delimiter; } } else { return $cats; } return $names; }
$debug = false; if (@$argv[1] == 'debug') { $debug = true; } $results = Database::singleton()->query_fetch_all($sql); foreach ($results as &$campaign) { $campaign = new Campaign($campaign['id']); switch ($campaign->calcStatus(true)) { case 2: break; case 1: $sql = 'SELECT aut_email FROM auth WHERE aut_agp_id = ' . $campaign->getGroup() . ' LIMIT 1'; $email = Database::singleton()->query_fetch($sql); $email = $email['aut_email']; $sql = 'SELECT agp_name FROM auth_groups WHERE agp_id = ' . $campaign->getGroup(); $group = Database::singleton()->query_fetch($sql); $group = $group['agp_name']; $campaign->mailOut('votes', $group, $email); if ($debug) { echo "Sent " . $campaign->getName() . " emails.\n"; } default: $sql = 'UPDATE campaigns SET autosend = 0 WHERE id = ' . $campaign->getId(); $result = Database::singleton()->query($sql); if ($debug) { echo "Removed " . $campaign->getName() . "'s autosend.\n"; } break; } } }
/** * The followings are the available columns in table 'profiles_fields': * @var integer $id * @var string $varname * @var string $title * @var string $field_type * @var integer $field_size * @var integer $required * @var string $error_message * @var string $default * @var integer $position * @var integer $visible */ public function tableName() { return Campaign::getId() . '_ProjectFields'; }
/** * * @param Campaign $campaign * @return Doctrine_Query */ public function queryByCampaign(Campaign $campaign) { return $this->createQuery('u')->orderBy('u.id')->leftJoin('u.CampaignRights cr')->where('cr.campaign_id = ?', $campaign->getId()); }
/** * Adds an object to the instance pool. * * Propel keeps cached copies of objects in an instance pool when they are retrieved * from the database. In some cases -- especially when you override doSelect*() * methods in your stub classes -- you may need to explicitly add objects * to the cache in order to ensure that the same objects are always returned by doSelect*() * and retrieveByPK*() calls. * * @param Campaign $value A Campaign object. * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). */ public static function addInstanceToPool(Campaign $obj, $key = null) { if (Propel::isInstancePoolingEnabled()) { if ($key === null) { $key = (string) $obj->getId(); } // if key === null self::$instances[$key] = $obj; } }
/** * * @param Campaign $campaign * @return CampaignRights */ public function getRightsByCampaign(Campaign $campaign) { if (array_key_exists($campaign->getId(), $this->cr_cache)) { return $this->cr_cache[$campaign->getId()]; } return $this->cr_cache[$campaign->getId()] = CampaignRightsTable::getInstance()->queryByCampaignAndUser($campaign, $this)->fetchOne(); }
public function tableName() { return Campaign::getId() . '_TipDone'; }
/** * @return string the associated database table name */ public function tableName() { return Campaign::getId() . '_Сatalog'; }
public function actionUpload() { Yii::import("ext.EAjaxUpload.qqFileUploader"); // --- кампании $c_id = Campaign::getId(); if ($c_id) { $folder = 'uploads/c' . $c_id . '/' . $_GET['id'] . '/'; } else { $folder = 'uploads/' . $_GET['id'] . '/'; } // --- if (!file_exists($folder)) { mkdir($folder, 0777); } $config['allowedExtensions'] = array('png', 'jpg', 'jpeg', 'gif', 'txt', 'doc', 'docx'); $config['disAllowedExtensions'] = array("exe"); $sizeLimit = 10 * 1024 * 1024; // maximum file size in bytes $uploader = new qqFileUploader($config, $sizeLimit); if (!User::model()->isAdmin()) { $_GET['qqfile'] = '#pre#' . $_GET['qqfile']; } $result = $uploader->handleUpload($folder, true); if ($result['success'] && User::model()->isCustomer()) { EventHelper::materialsAdded($_GET['id']); } $result['fileSize'] = filesize($folder . $result['filename']); //GETTING FILE SIZE $result['fileName'] = $result['filename']; //GETTING FILE NAME chmod($folder . $result['fileName'], 0666); echo htmlspecialchars(json_encode($result), ENT_NOQUOTES); }
public function search() { // @todo Please modify the following code to remove attributes that should not be searched. $criteria = new CDbCriteria(); if (Campaign::getId()) { $criteria->compare('id', $this->id); $criteria->compare('DATE_FORMAT(date, "%d.%m.%Y")', substr($this->dbdate, 0, 10), true); $criteria->compare('DATE_FORMAT(manager_informed, "%d.%m.%Y")', substr($this->dbmanager_informed, 0, 10), true); $fields = $this->getFields(); foreach ($fields as $field) { $tmp = $field->varname; if (isset($this->{$tmp}) && $field->field_type == 'LIST' && $this->{$tmp} != '') { $criteria->compare($tmp, explode(',', $this->{$tmp})); } else { $criteria->compare($tmp, $this->{$tmp}); } } $criteria->compare('executor', $this->executor); if (!$this->status or $this->status == 0) { /// Так ли делать $criteria->addNotInCondition('status', array(5)); } else { if ($this->status == -1) { // show all } else { $criteria->compare('status', $this->status); } } $sort = new CSort(); $sort->defaultOrder = 't.id ASC'; $sort->attributes = array('dateCreation' => array('asc' => 't.date', 'desc' => 't.date desc'), 'managerInformed' => array('asc' => 't.manager_informed', 'desc' => 't.manager_informed desc'), 'dateFinish' => array('asc' => 't.date_finish', 'desc' => 't.date_finish desc'), '*'); } else { $criteria->with = array('job', 'category'); $criteria->compare('t.id', $this->id); $criteria->compare('job_id', $this->jobName); $criteria->compare('category_id', $this->catName); $criteria->compare('title', $this->title, true); $criteria->compare('DATE_FORMAT(date, "%d.%m.%Y")', substr($this->dbdate, 0, 10), true); $criteria->compare('DATE_FORMAT(manager_informed, "%d.%m.%Y")', substr($this->dbmanager_informed, 0, 10), true); if (isset($this->dbdate_finishend) && isset($this->dbdate_finishstart)) { $criteria->addCondition('"' . $this->dbdate_finishstart . '"<=DATE_FORMAT(date_finish, "%d.%m.%Y")<="' . $this->dbdate_finishend . '"'); $criteria->addCondition('date_finish is not NULL'); } else { $criteria->compare('DATE_FORMAT(date_finish, "%d.%m.%Y")', substr($this->dbdate_finishstart, 0, 10), true); } $criteria->compare('executor', $this->executor); if (!$this->status or $this->status == 0) { $criteria->addNotInCondition('status', array(5)); } else { if ($this->status == -1) { // show all } else { $criteria->compare('status', $this->status); } } $sort = new CSort(); $sort->defaultOrder = 't.id ASC'; $sort->attributes = array('jobName' => array('asc' => 'job.job_name', 'desc' => 'job.job_name desc'), 'catName' => array('asc' => 'category.cat_name', 'desc' => 'category.cat_name desc'), 'id' => array('asc' => 't.id', 'desc' => 't.id desc'), 'title' => array('asc' => 't.title', 'desc' => 't.title desc'), 'dateCreation' => array('asc' => 't.date', 'desc' => 't.date desc'), 'managerInformed' => array('asc' => 't.manager_informed', 'desc' => 't.manager_informed desc'), 'dateFinish' => array('asc' => 't.date_finish', 'desc' => 't.date_finish desc'), '*'); } return new CActiveDataProvider($this, array('criteria' => $criteria, 'sort' => $sort, 'pagination' => false)); }
function getAdminInterface() { $this->addJS('/modules/Campaigns/js/voteadmin.js'); $this->addCSS('/modules/Campaigns/css/campaign.css'); switch (@$_REQUEST['section']) { case 'addedit': if ($this->user->hasPerm('addcampaign')) { $campaign = new Campaign(@$_REQUEST['campaign_id']); $form = $campaign->getAddEditForm(); $this->smarty->assign('form', $form); $this->smarty->assign('status', $campaign->getId()); if ($form->isSubmitted() && isset($_REQUEST['submit'])) { if ($form->validate()) { return $this->topLevelAdmin(); } } return $this->smarty->fetch('admin/campaigns_addedit.tpl'); } return $this->smarty->fetch('../../../cms/templates/error.tpl'); case 'campaigndelete': $campaign = new Campaign($_REQUEST['campaign_id']); if ($this->user->hasPerm('addcampaign') && $this->user->getAuthGroup() == $campaign->getGroup() && strpos($campaign->getStatus(), 'pcoming') > 0) { $campaign->delete(); unset($campaign); return $this->topLevelAdmin(); } return $this->smarty->fetch('../../../cms/templates/error.tpl'); case 'viewresults': if ($this->user->hasPerm('viewcampaign')) { $campaign = new Campaign($_REQUEST['campaign_id']); $this->smarty->assign('campaign', $campaign); $campaign->addResultViewer($this->user->getId()); return $this->smarty->fetch('admin/campaign_results.tpl'); } return $this->smarty->fetch('admin/campaign_recips_addedit.tpl'); case 'questionedit': if ($this->user->hasPerm('addcampaign')) { $campaign = new Campaign($_REQUEST['campaign_id']); $this->smarty->assign('campaign', $campaign); if (isset($_REQUEST['choices_submit'])) { if (!is_null(@$_REQUEST['choice'])) { foreach ($_REQUEST['choice'] as $key => $achoice) { if (is_numeric($key)) { $choice = new CampaignChoice($key); if (!empty($achoice['main'])) { $choice->setCampaign($_REQUEST['campaign_id']); $choice->setChoice($achoice['main']); $choice->save(); if (is_array(@$_REQUEST['choice'][$key])) { $choice->createChildren($_REQUEST['choice'][$key]); } } else { $choice->delete(); } } } } if (!is_null(@$_REQUEST['nChoice'])) { if (isset($_REQUEST['nChoice'])) { foreach ($_REQUEST['nChoice'] as $key => $achoice) { if (!empty($achoice['main'])) { $choice = new CampaignChoice(); $choice->setCampaign($_REQUEST['campaign_id']); $choice->setChoice($achoice['main']); $choice->save(); if (is_array(@$_REQUEST['nChoice'][$key])) { $choice->createChildren($_REQUEST['nChoice'][$key]); } } } } } return $this->topLevelAdmin(); } return $this->smarty->fetch('admin/campaign_choices_addedit.tpl'); } return $this->smarty->fetch('../../../cms/templates/error.tpl'); case 'reciplist': return $this->recipTopLevelAdmin(); case 'recipaddedit': if ($this->user->hasPerm('addcampaignrecips')) { if (!is_null(@$_REQUEST['recipient_id'])) { $recipient = new CampaignUser($_REQUEST['recipient_id']); } else { $recipient = new CampaignUser(); $recipient->setGroup($this->user->getAuthGroup()); } $form = $recipient->getAddEditForm(); $this->smarty->assign('form', $form); if ($form->isSubmitted() && isset($_REQUEST['submit'])) { if ($form->validate()) { return $this->recipTopLevelAdmin(); } } return $this->smarty->fetch('admin/campaign_recips_addedit.tpl'); } return $this->smarty->fetch('../../../cms/templates/error.tpl'); case 'recipcsvup': if ($this->user->hasPerm('addcampaignrecips')) { $form = Campaign::getCSVForm(); $this->smarty->assign('form', $form); if ($form->validate() && $form->isSubmitted() && $_POST['submit']) { return $this->recipTopLevelAdmin(); } return $this->smarty->fetch('admin/campaign_csvup.tpl'); } return $this->smarty->fetch('../../../cms/templates/error.tpl'); case 'recipdelete': if ($this->user->hasPerm('addcampaignrecips')) { if (!is_null($_REQUEST['id']) && CampaignUser::exists($_REQUEST['id'])) { $recipient = new CampaignUser($_REQUEST['id']); if ($recipient->getGroup() == $this->user->getAuthGroup()) { $recipient->delete(); unset($_REQUEST['id']); } else { return $this->smarty->fetch('../../../cms/templates/error.tpl'); } } return $this->recipTopLevelAdmin(); } return $this->smarty->fetch('../../../cms/templates/error.tpl'); case 'votesend': if ($this->user->hasPerm('addcampaignrecips')) { $campaign = new Campaign($_REQUEST['campaign_id']); return $campaign->mailOut('votes'); } return 'You do not have permission to perform this action.'; case 'voteprint': if ($this->user->hasPerm('generatereciplist')) { $campaign = new Campaign($_REQUEST['campaign_id']); $campaign->preparePdf(); } return $this->topLevelAdmin(); case 'resultsend': if ($this->user->hasPerm('addcampaignrecips')) { $campaign = new Campaign($_REQUEST['campaign_id']); return $campaign->mailOut('results'); } return 'You do not have permission to perform this action.'; case 'listbilling': if ($this->user->hasPerm('admin')) { $groups = Group::getGroups(); $this->smarty->assign('groups', $groups); return $this->smarty->fetch('admin/billing_list.tpl'); } case 'viewbilling': if ($this->user->hasPerm('admin')) { $group = new Group($_REQUEST['group_id']); $this->smarty->assign('group', $group); $campaigns = Campaign::getCampaigns($_REQUEST['group_id']); $campaignsSorted = array_merge($campaigns['upcoming'], $campaigns['progress'], $campaigns['ended']); $this->smarty->assign('campaigns', $campaignsSorted); return $this->smarty->fetch('admin/billing_view.tpl'); } case 'togglestatus': if ($this->user->hasPerm('admin')) { $group = new Group($_REQUEST['group_id']); if ($group->getStatus() > 0) { $group->setStatus(0); } else { $group->setStatus(1); } $group->save(); } $groups = Group::getGroups(); $this->smarty->assign('groups', $groups); return $this->smarty->fetch('admin/billing_list.tpl'); break; case 'whovoted': if ($this->user->hasPerm('addcampaign')) { $campaign = new Campaign($_REQUEST['campaign_id']); $this->smarty->assign('votedlist', $campaign->userVotedList()); $this->smarty->assign('notvotedlist', $campaign->userVotedList(false)); $this->smarty->assign('campaignName', $campaign->getName()); return $this->smarty->fetch('admin/voted_list.tpl'); } return $this->topLevelAdmin(); case 'archivecampaign': if ($this->user->hasPerm('addcampaign')) { $campaign = new Campaign($_REQUEST['campaign_id']); $campaign->setArchiveStatus(1); $campaign->save(); } return $this->topLevelAdmin(); case 'viewarchive': if ($this->user->hasPerm('viewcampaign')) { $campaigns = Campaign::getCampaigns($this->user->getAuthGroup(), 1, 'endDate ASC'); $this->smarty->assign('campaigns', $campaigns); $this->smarty->assign('company', $this->user->getAuthGroupName()); return $this->smarty->fetch('admin/campaign_archive.tpl'); } return $this->topLevelAdmin(); default: if ($this->user->hasPerm('admin') && !$this->user->hasPerm('viewcampaign')) { header("Location: /admin/Campaigns§ion=listbilling"); } return $this->topLevelAdmin(); } }
public static function getFolder() { return '/uploads/c' . Campaign::getId() . '/payments/'; }
/** * Registration user */ public function actionRegistration() { $model = new RegistrationForm(); if (isset($_GET['role']) && $_GET['role'] == 'Customer') { $role = 'Customer'; } elseif (isset($_GET['role']) && $_GET['role'] == 'Author') { $role = 'Author'; } elseif (isset($_GET['role']) && $_GET['role'] == 'Manager') { $role = 'Manager'; } else { $role = 'Customer'; } if (Yii::app()->user->id && (!Yii::app()->user->hasFlash('reg_success') && !Yii::app()->user->hasFlash('reg_failed'))) { $this->redirect(Yii::app()->controller->module->profileUrl); } else { if (isset($_POST['RegistrationForm'])) { $model->attributes = $_POST['RegistrationForm']; if ($model->validate()) { $soucePassword = $this->generate_password(8); $model->password = UserModule::encrypting($soucePassword); $model->superuser = 0; $model->status = 1; $model->username = $model->email; if ($model->save()) { $AuthAssignment = new AuthAssignment(); $AuthAssignment->attributes = array('itemname' => $role, 'userid' => $model->id); $AuthAssignment->save(); //$login_url = '<a href="'.$this->createAbsoluteUrl('/user/login').'">'.Yii::app()->name.'</a>'; //UserModule::sendMail($model->email,UserModule::t("You registered from {site_name}",array('{site_name}'=>Yii::app()->name)),UserModule::t("You have registred from {login_url}<br /><br />Your password: {pass}",array('{login_url}'=>$login_url, '{pass}'=>$soucePassword))); // новая служба системных сообщений $type_id = Emails::TYPE_11; $email = new Emails(); $criteria = new CDbCriteria(); $criteria->order = 'id DESC'; $criteria->limit = 1; $user = User::model()->findAll($criteria); $user = $user[0]; $email->from_id = 1; $email->to_id = $user->id; $rec = Templates::model()->findAll("`type_id`='{$type_id}'"); $title = $rec[0]->title; $body = $rec[0]->text; $id = Campaign::getId(); $email->campaign = Campaign::getName(); $email->name = $model->full_name; $email->login = $model->username; $email->password = $soucePassword; $email->page_cabinet = 'http://' . $_SERVER['SERVER_NAME'] . '/user/profile/edit'; $email->sendTo($user->email, $body, $type_id); $identity = new UserIdentity($model->username, $soucePassword); $identity->authenticate(); Yii::app()->user->login($identity, 0); //$this->redirect(Yii::app()->controller->module->returnUrl); Yii::app()->user->setFlash('reg_success', UserModule::t("Thank you for your registration. Password has been sent to your e-mail. Please check your e-mail ({{email}}) before start.", ['{{email}}' => $model->email])); $this->refresh(); //Yii::app()->end(); } else { Yii::app()->user->setFlash('reg_failed', UserModule::t("Sorry, something wrong... :(")); $this->refresh(); } } } Yii::app()->theme = 'client'; $this->render('/user/registration', array('model' => $model, 'role' => $role)); } }
<?php echo $form->labelEx($model, 'edu_dep'); ?> <br> <?php echo $form->textField($model, 'edu_dep'); ?> <?php echo $form->error($model, 'edu_dep'); ?> <?php } ?> </div> <?php if (!Campaign::getId()) { ?> <div class="col-xs-6 info-column"> <?php echo $form->labelEx($model, 'add_demands'); ?> <br> <?php echo $form->textArea($model, 'add_demands', array('rows' => 6, 'cols' => 53)); ?> <?php echo $form->error($model, 'add_demands'); ?> </div> <?php
/** * Declares an association between this object and a Campaign object. * * @param Campaign $v * @return Donation The current object (for fluent API support) * @throws PropelException */ public function setCampaign(Campaign $v = null) { if ($v === null) { $this->setCampainId(NULL); } else { $this->setCampainId($v->getId()); } $this->aCampaign = $v; // Add binding for other direction of this n:n relationship. // If this object has already been added to the Campaign object, it will not be re-added. if ($v !== null) { $v->addDonation($this); } return $this; }
<?php Yii::app()->getClientScript()->registerCssFile(Yii::app()->theme->baseUrl . '/css/manager.css'); ?> <div class="row white-bg inside-block"> <div class="col-md-12"> <?php $this->breadcrumbs = array(ProjectModule::t('Zakazs')); if (Campaign::getId()) { $columns = array('id'); $projectFields = $model->getFields(); if ($projectFields) { foreach ($projectFields as $field) { if ($field->field_type == "LIST") { $varname = $field->varname; $columns[] = array('name' => $varname, 'filter' => Catalog::getAll($varname), 'value' => '$data->catalog_' . $varname . '->cat_name'); } elseif ($field->varname != 'soderjanie' && $field->varname != 'description' && $field->varname != 'opisanie') { // !!! Сделать настраиваемым $columns[] = $field->varname; } } } /*$columns[] = array( 'name'=>'date', 'filter' => $this->widget('zii.widgets.jui.CJuiDatePicker', array( 'model'=>$model, 'attribute'=>'dbdate', 'language'=>Yii::app()->language, ),true), 'value'=>'$data->dbdate'
public function queryCallTicketForCampaign(Campaign $campaign, $not_id = null) { $query = $this->queryAll()->where('t.campaign_id = ?', $campaign->getId())->andWhereIn('t.status', array(TicketTable::STATUS_NEW, TicketTable::STATUS_READ, TicketTable::STATUS_WAIT))->andWhere('t.kind = ?', TicketTable::KIND_CALL_DATA_OFFICER); if ($not_id) { $query->andWhere('t.id != ?', $not_id); } return $query; }