本文整理汇总了PHP中Company::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Company::model方法的具体用法?PHP Company::model怎么用?PHP Company::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Company
的用法示例。
在下文中一共展示了Company::model方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionEdit
public function actionEdit($id = false)
{
if ($id) {
$model = Company::model()->findByPk($id);
} else {
$model = Company::getCompany();
}
if (isset($_POST['ajax']) && $_POST['ajax'] === 'company-form') {
echo UActiveForm::validate(array($model));
Yii::app()->end();
}
if (isset($_POST['Company'])) {
$model->attributes = $_POST['Company'];
$model->fileupload = CUploadedFile::getInstance($model, 'fileupload');
$model->iconupload = CUploadedFile::getInstance($model, 'iconupload');
if ($model->validate()) {
$model->save();
Yii::app()->user->setFlash('companySuccessMessage', ProjectModule::t('Successfully updated'));
//$this->redirect(array('/user/profile'));
} else {
Yii::app()->user->setFlash('companyErrorMessage', ProjectModule::t('Something wrong'));
}
}
//Yii::app()->theme = 'admin';
$this->render('edit', array('model' => $model, 'root' => User::model()->getUserRole() == 'root'));
}
示例2: up
public function up()
{
$companys = Company::model()->findAll();
foreach ($companys as $company) {
$this->update($company->prefix . 'transactionType', array("name" => "Supplier Invoice"), "id=2");
}
}
示例3: run
public function run($id = null, $page = 1, $size = 2)
{
$this->controller->pageTitle = "Profile";
if (Yii::app()->request->isAjaxRequest) {
if (!$id) {
$id = Yii::app()->user->id;
}
$post = new CPost();
$result = $post->getProfileList($id, $page, $size);
echo CJSON::encode(array('code' => 200, 'mes' => 'success', 'data' => array('list' => $result['data'])));
} else {
if ($id) {
$user = User::model()->with('companyid')->findByAttributes(array('id' => $id));
$company = Company::model()->findByAttributes(array('ownerId' => $user['id']));
$location = Hub::model()->findByAttributes(array('id' => $company['location']));
$post = new CPost();
$postlist = $post->getProfileList($id);
} else {
$id = Yii::app()->user->id;
$user = User::model()->with('companyid')->findByAttributes(array('id' => $id));
$company = Company::model()->findByAttributes(array('ownerId' => $user['id']));
$location = Hub::model()->findByAttributes(array('id' => $company['location']));
$post = new CPost();
$postlist = $post->getProfileList($id);
}
$this->controller->render('profile', array('user' => $user, 'companylocation' => $location['location'], 'postlist' => $postlist['data']));
}
}
示例4: actionIndex
public function actionIndex()
{
$criteria = new CDbCriteria();
// 创建CDbCriteria对象
$criteria->condition = "(style & 2) !=0";
// 设置查询条件
$cheap = Route::model()->findAll($criteria);
$criteria->condition = '(style&4) !=0';
$hot = Route::model()->findAll($criteria);
$area = Area::model()->findAll();
$criteria1 = new CDbCriteria();
// 创建CDbCriteria对象
$criteria1->select = "title";
// 设置查询条件
$criteria1->limit = 8;
$diary = Diary::model()->findAll($criteria1);
$continent = Continent::model()->findAll();
$boat = Boat::model()->findAll();
//var_dump($continent);
$this->g_area = $area;
$this->g_continent = $continent;
$this->g_company = Company::model()->findAll();
$year = date("Y");
$month = date('n');
$arr = array();
for ($i = $month; $i <= 12; $i++) {
array_push($arr, $year . '年' . $i . '月');
}
$year += 1;
for ($i = 1; $i <= 12; $i++) {
array_push($arr, $year . '年' . $i . '月');
}
$this->g_data = $arr;
$this->render('index', array('hot' => $hot, 'cheap' => $cheap, 'area' => $area, 'diary' => $diary, 'continent' => $continent, 'boat' => $boat));
}
示例5: run
public function run($args)
{
$companies = Company::model()->findAll('frozen=:p AND telfin_id<>:t', array(':p' => '0', ':t' => ''));
foreach ($companies as $company) {
Company::setActive($company);
Yii::app()->language = Company::getLanguage();
//User::model()->refreshMetaData();
/*AuthAssignment::model()->refreshMetaData();
ProfileField::model()->refreshMetaData();
Profile::model()->refreshMetaData();
Zakaz::model()->refreshMetaData();
ZakazParts::model()->refreshMetaData();
Events::model()->refreshMetaData();*/
//self::executor();
//self::manager();
//echo '=)';
Yii::app()->cdr->init('cron');
CrmCdr::model()->refreshMetaData();
// Проверим нет ли сохраненного токена в сессии
// Работу с сессией вынес в прикладной код, потому что врапер может вызываться из командной строки
//Yii::app()->cdr->cookie2token();
// Обновим данные из Телфина
Yii::app()->cdr->refresh();
// Сохраним токен в сессии есть есть что сохранять
//Yii::app()->cdr->token2cookie();
}
}
示例6: init
public function init()
{
/*
if(!isset(Yii::app()->user->Company)){
Yii::app()->user->setState('Company',0);
} */
Yii::log("Selected Company ID: " . Yii::app()->user->Company, 'info', 'app');
if (Yii::app()->user->Company == 0) {
if (Yii::app()->controller->id != 'company') {
//print "'".Yii::app()->controller->id."'";
$this->redirect(Yii::app()->createAbsoluteUrl('company/index'));
Yii::app()->end();
} else {
Yii::app()->db->setActive(false);
Yii::app()->db->connectionString = Yii::app()->dbMain->connectionString;
Yii::app()->db->tablePrefix = Yii::app()->dbMain->tablePrefix;
Yii::app()->db->username = Yii::app()->dbMain->username;
Yii::app()->db->password = Yii::app()->dbMain->password;
Yii::app()->db->setActive(true);
}
} else {
//hasAccess!
$this->company = Company::model()->findByPk(Yii::app()->user->Company);
Company::model()->loadComp($this->company);
}
//*/
return parent::init();
}
示例7: run
/**
* Запуск виджета
*/
public function run()
{
$insurences = array();
$deliveries = array();
$customes = array();
if ($this->insurence_count != 0) {
$criteria = new CDbCriteria();
$criteria->condition = 't.insurance_desc !="0"';
$criteria->limit = 5;
$insurences_all = Company::model()->findAll($criteria);
$cnt = count($insurences_all) - 1;
if ($cnt <= $this->insurence_count) {
$insurences = $insurences_all;
} else {
for ($i = 0; $i <= $this->insurence_count; $i++) {
$random = rand(0, $cnt - $i);
$insurences[] = $insurences_all[$random];
unset($insurences_all[$random]);
$insurences_all = array_values($insurences_all);
}
}
}
if ($this->delivery_count != 0) {
$criteria = new CDbCriteria();
$criteria->condition = 't.delivery_desc !="0"';
$criteria->limit = 5;
$deliveries_all = Company::model()->findAll($criteria);
$cnt = count($deliveries_all) - 1;
if ($cnt <= $this->delivery_count) {
$deliveries = $deliveries_all;
} else {
for ($i = 0; $i <= $this->delivery_count; $i++) {
//echo $cnt;die();
$random = rand(0, $cnt - $i);
$deliveries[] = $deliveries_all[$random];
unset($deliveries_all[$random]);
$deliveries_all = array_values($deliveries_all);
}
}
}
if ($this->customes_count != 0) {
$criteria = new CDbCriteria();
$criteria->condition = 't.customs_desc !="0"';
$criteria->limit = 5;
$customes_all = Company::model()->findAll($criteria);
$cnt = count($customes_all) - 1;
if ($cnt <= $this->customes_count) {
$customes = $customes_all;
} else {
for ($i = 0; $i <= $this->customes_count; $i++) {
$random = rand(0, $cnt - $i);
$customes[] = $customes_all[$random];
unset($customes_all[$random]);
$customes_all = array_values($customes_all);
}
}
}
$this->render('index', ['insurences' => $insurences, 'deliveries' => $deliveries, 'customes' => $customes]);
}
示例8: down
public function down()
{
$companys = Company::model()->findAll();
foreach ($companys as $company) {
$this->update($company->prefix . 'docStatus', array("action" => "1"), "num=2 AND doc_type=4");
}
return true;
}
示例9: down
public function down()
{
$companys = Company::model()->findAll();
foreach ($companys as $company) {
$this->dropColumn($company->prefix . 'files', 'hidden');
}
return true;
}
示例10: actionViewCompDetails
public function actionViewCompDetails($c_id)
{
$model = Company::model()->findByPk($c_id);
if ($model === null) {
throw new CHttpException(404, 'The requested page does not exist.');
}
$this->render('viewCompDetails', array('model' => $model));
}
示例11: down
public function down()
{
$companys = Company::model()->findAll();
foreach ($companys as $company) {
$this->delete($company->prefix . 'paymentType', "id=7");
}
return true;
}
示例12: actionCreatedetail
public function actionCreatedetail()
{
$sodetail = new Sodetail();
if (Yii::app()->request->isAjaxRequest) {
echo CJSON::encode(array('status' => 'success', 'currencyid' => Company::model()->getcurrencyid(), 'currencyname' => Company::model()->getcurrencyname(), 'divcreate' => $this->renderPartial('_formdetail', array('model' => $sodetail), true)));
Yii::app()->end();
}
}
示例13: up
public function up()
{
return true;
$companys = Company::model()->findAll();
foreach ($companys as $company) {
$this->alterColumn($company->prefix . 'transactions', "valuedate", 'TIMESTAMP NOT NULL DEFAULT "0000-00-00 00:00:00"');
$this->alterColumn($company->prefix . 'transactions', "date", "TIMESTAMP on update CURRENT_TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP");
}
}
示例14: up
public function up()
{
//return false;
$companys = Company::model()->findAll();
foreach ($companys as $company) {
$this->addColumn($company->prefix . 'docs', 'refnum_ext', 'varchar(255) AFTER `refnum`');
//*/
}
}
示例15: up
public function up()
{
//return false;
//$this->update( 'menu', array("url"=>"newUpdate"), "id=64");
$companys = Company::model()->findAll();
foreach ($companys as $company) {
$this->dropColumn($company->prefix . 'transactions', 'due_date');
}
}