private function getCpOptions() { $options = array(); foreach (CP::model()->findAll() as $cp) { $options[$cp->id] = $cp->name; } return $options; }
function __construct() { parent::__construct(); $this->Shell = CP::GetShellInstance(); $this->Validator = CP::GetValidatorInstance(); $this->OpenSSL = CF_ENV_OPENSSL; $this->SSLRoot = CF_ENV_HOMEROOT ."/". CF_ENV_HOMENAME ."/". CF_ENV_SSLROOT; $this->Date = date("j-n-Y"); }
function __construct() { parent::__construct(); $this->Shell = CP::GetShellInstance(); // DSN $dsn = str_replace("{PASSWD}", CF_MYSQL_PASSWD, CF_MYSQL_DSN); // Connect to server as root self::$SDB = DB::connect($dsn); if (DB::isError(self::$SDB)) { $this->RaiseError("Cannot connect to local MySQL server! "); } self::$SDB->setFetchmode(DB_FETCHMODE_ASSOC); $this->PrivsSuported = array("SELECT", "INSERT", "INDEX", "UPDATE", "DELETE", "CREATE", "DROP", "REFERENCES", "ALTER", "CREATE TEMPORARY TABLES", "LOCK TABLES"); }
/** * @ignore * */ function __construct() { parent::__construct(); $this->Shell = CP::GetShellInstance(); }
public function getTableName() { $filters = $this->getFilterCondition(); $conditions = array(); if (isset($filters['cp_id'])) { $model = CP::model()->findByPk($filters['cp_id']); if ($model) { $conditions[] = "CP:{$model->name}"; } } if (isset($filters['adv_id'])) { $model = Advertise::model()->findByPk($filters['adv_id']); if ($model) { $conditions[] = "业务:{$model->name}"; } } if (isset($filters['channel_id'])) { $model = Channel::model()->findByPk($filters['channel_id']); if ($model) { $conditions[] = "渠道:{$model->name}"; } } /*2014-11-17包名*/ if (isset($filters['adv_channel_id'])) { $model = AdvertiseChannel::model()->findByPk($filters['adv_channel_id']); if ($model) { $conditions[] = "包名:{$model->tag}"; } } /*end*/ if (isset($filters['begin_date']) && isset($filters['end_date'])) { $conditions[] = "从{$filters['begin_date']}到{$filters['end_date']}"; } if (isset($filters['date'])) { $conditions[] = "日期:{$filters['date']}"; } if (count($conditions)) { return $this->getTableBaseName() . '-(' . join('-', $conditions) . ')'; } else { return $this->getTableBaseName() . '-全部'; } }
<?php if (!class_exists('CP')) { exit('Copernicus Plugin not activated. Please Install and Activate to continue.'); } CP::header(); CP::view('header.html'); CP::template(); CP::view('footer.html'); CP::footer();
protected function getIndexCriteria($kw_search = "") { $criteria = new CDbCriteria(); $criteria->order = 't.ctime desc'; /* 添加搜索条件 10-29*/ if ($this->getModelClass() == 'CP') { $criteria->addSearchCondition('name', $kw_search, true, 'OR'); $criteria->addSearchCondition('fullname', $kw_search, true, 'OR'); } elseif ($this->getModelClass() == 'Advertise') { $first = new CDbCriteria(); $first->addSearchCondition('name', $kw_search); $cp = CP::model()->findAll($first); $i = 0; foreach ($cp as $c) { $arrcp[$i] = $c->id; $i++; } $criteria->addInCondition('cp_id', $arrcp, 'OR'); $criteria->addSearchCondition('name', $kw_search, true, 'OR'); } elseif ($this->getModelClass() == 'Channel') { $criteria->addSearchCondition('name', $kw_search); } else { } foreach ($this->getFilterCondition() as $field => $value) { //不加t. ActiveRecord join的时候容易出现重名字段冲突 $criteria->compare('t.' . $field, $value); } return $criteria; }