本文整理汇总了PHP中Campaign::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Campaign::getId方法的具体用法?PHP Campaign::getId怎么用?PHP Campaign::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Campaign
的用法示例。
在下文中一共展示了Campaign::getId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init()
{
//'itemTable'=>'AuthItem',
//'itemChildTable'=>'AuthItemChild',
$this->assignmentTable = Campaign::getId() . '_AuthAssignment';
parent::init();
}
示例2: 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);
}
示例3: queryByCampaign
/**
*
* @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;
}
示例4: init
public function init()
{
$c_id = Campaign::getId();
if ($c_id) {
self::$folder = '/uploads/c' . $c_id . '/payments/';
} else {
self::$folder = '/uploads/payments/';
}
}
示例5: tableName
public function tableName()
{
$c_id = Campaign::getId();
if ($c_id) {
return $c_id . '_Projects';
} else {
return 'Projects';
}
}
示例6: tableName
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;
}
}
示例7: folder
public function folder()
{
// --- campaign
$c_id = Campaign::getId();
if ($c_id) {
return '/uploads/c' . $c_id . '/parts/';
} else {
return '/uploads/additions/';
}
}
示例8: actionApiView
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();
}
}
示例9: getTableName
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";
}
示例10: queryByCampaign
/**
*
* @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;
}
示例11: tableName
/**
* @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';
}
示例12: tableName
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';*/
}
示例13: init
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();
}
示例14: getNamesByIds
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;
}
示例15: foreach
$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;
}
}
}