当前位置: 首页>>代码示例>>PHP>>正文


PHP x2base::create方法代码示例

本文整理汇总了PHP中x2base::create方法的典型用法代码示例。如果您正苦于以下问题:PHP x2base::create方法的具体用法?PHP x2base::create怎么用?PHP x2base::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在x2base的用法示例。


在下文中一共展示了x2base::create方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new BugReports();
     $users = User::getNames();
     if (isset($_POST['BugReports'])) {
         $temp = $model->attributes;
         $model->setX2Fields($_POST['BugReports']);
         parent::create($model, $temp, 0);
     }
     $this->render('create', array('model' => $model, 'users' => $users));
 }
开发者ID:tymiles003,项目名称:X2CRM,代码行数:15,代码来源:BugReportsController.php

示例2: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Product();
     $users = User::getNames();
     if (isset($_POST['Product'])) {
         $temp = $model->attributes;
         foreach ($_POST['Product'] as $name => &$value) {
             if ($value == $model->getAttributeLabel($name)) {
                 $value = '';
             }
         }
         foreach ($_POST as $key => $arr) {
             $pieces = explode("_", $key);
             if (isset($pieces[0]) && $pieces[0] == 'autoselect') {
                 $newKey = $pieces[1];
                 if (isset($_POST[$newKey . "_id"]) && $_POST[$newKey . "_id"] != "") {
                     $val = $_POST[$newKey . "_id"];
                 } else {
                     $field = Fields::model()->findByAttributes(array('fieldName' => $newKey));
                     if (isset($field)) {
                         $type = ucfirst($field->linkType);
                         if ($type != "Contacts") {
                             eval("\$lookupModel={$type}::model()->findByAttributes(array('name'=>'{$arr}'));");
                         } else {
                             $names = explode(" ", $arr);
                             $lookupModel = Contacts::model()->findByAttributes(array('firstName' => $names[0], 'lastName' => $names[1]));
                         }
                         if (isset($lookupModel)) {
                             $val = $lookupModel->id;
                         } else {
                             $val = $arr;
                         }
                     }
                 }
                 $model->{$newKey} = $val;
             }
         }
         foreach (array_keys($model->attributes) as $field) {
             if (isset($_POST['Product'][$field])) {
                 $model->{$field} = $_POST['Product'][$field];
                 $fieldData = Fields::model()->findByAttributes(array('modelName' => 'Products', 'fieldName' => $field));
                 if ($fieldData->type == 'assignment' && $fieldData->linkType == 'multiple') {
                     $model->{$field} = Accounts::parseUsers($model->{$field});
                 } elseif ($fieldData->type == 'date') {
                     $model->{$field} = strtotime($model->{$field});
                 }
             }
         }
         //               $model->price = $this->parseCurrency($model->price,false);
         $model->createDate = time();
         parent::create($model, $temp, 0);
     }
     $this->render('create', array('model' => $model, 'users' => $users));
 }
开发者ID:netconstructor,项目名称:X2Engine,代码行数:58,代码来源:DefaultController.php

示例3: create

 public function create($model, $oldAttributes, $api)
 {
     if ($model->associationId == '') {
         $model->associationId = 0;
     }
     //if($model->
     $model->createDate = time();
     // created now, full datetime
     //$model->associationId=$_POST['Actions']['associationId'];
     $dueDate = $this->parseDateTime($model->dueDate);
     $model->dueDate = $dueDate === false ? '' : $dueDate;
     //date('Y-m-d',$dueDate).' 23:59:59';	// default to being due by 11:59 PM
     //if($type=='none')
     //	$model->associationId=0;
     //$model->associationType=$type;
     $association = $this->getAssociation($model->associationType, $model->associationId);
     if ($association != null) {
         $model->associationName = $association->name;
     } else {
         $model->associationName = 'None';
         //$model->associationId = 0;
     }
     if ($model->associationName == 'None' && $model->associationType != 'none') {
         $model->associationName = ucfirst($model->associationType);
     }
     //		$this->render('test', array('model'=>$model));
     if ($model->type != 'event' && isset($_POST['submit']) && ($_POST['submit'] == '0' || $_POST['submit'] == '2')) {
         // if user clicked "New Comment" rather than "New Action"
         $model->createDate = time();
         $model->dueDate = time();
         $model->completeDate = time();
         $model->complete = 'Yes';
         $model->visibility = '1';
         $model->assignedTo = Yii::app()->user->getName();
         $model->completedBy = Yii::app()->user->getName();
         $model->type = $_POST['submit'] == 2 ? 'note' : 'call';
     } else {
         if ($model->type == 'event') {
             if ($model->completeDate) {
                 $model->completeDate = $this->parseDateTime($model->completeDate);
             }
         }
     }
     if (!is_numeric($model->assignedTo)) {
         // assigned to user
         $profile = ProfileChild::model()->findByAttributes(array('username' => $model->assignedTo));
         $profile->syncActionToGoogleCalendar($model);
         // sync action to Google Calendar if user has a Google Calendar
     }
     if ($api == 0) {
         parent::create($model, $oldAttributes, $api);
     } else {
         return parent::create($model, $oldAttributes, $api);
     }
 }
开发者ID:netconstructor,项目名称:X2Engine,代码行数:55,代码来源:DefaultController.php

示例4: create

 public function create($model, $oldAttributes, $api = 0)
 {
     // process currency into an INT
     //		$model->quoteAmount = $this->parseCurrency($model->quoteAmount,false);
     if (isset($model->associatedContacts)) {
         $model->associatedContacts = Sales::parseContacts($model->associatedContacts);
     }
     $model->createDate = time();
     $model->lastUpdated = time();
     // $model->expectedCloseDate = $this->parseDate($model->expectedCloseDate);
     parent::create($model, $oldAttributes, '0');
 }
开发者ID:netconstructor,项目名称:X2Engine,代码行数:12,代码来源:DefaultController.php

示例5: create

 public function create($model, $oldAttributes, $api)
 {
     if ($api == 0) {
         parent::create($model, $oldAttributes, $api);
     } else {
         return parent::create($model, $oldAttributes, $api);
     }
 }
开发者ID:dsyman2,项目名称:X2CRM,代码行数:8,代码来源:ActionsController.php

示例6: createOpportunity

 /**
  * Creates opportunity record
  *
  * Call this function from createRecords
  */
 public function createOpportunity($model, $oldAttributes, $api = 0)
 {
     // process currency into an INT
     //        $model->quoteAmount = Formatter::parseCurrency($model->quoteAmount,false);
     if (isset($model->associatedContacts)) {
         $model->associatedContacts = Opportunity::parseContacts($model->associatedContacts);
     }
     $model->createDate = time();
     $model->lastUpdated = time();
     // $model->expectedCloseDate = Formatter::parseDate($model->expectedCloseDate);
     if ($api == 1) {
         return parent::create($model, $oldAttributes, $api);
     } else {
         parent::create($model, $oldAttributes, '0');
     }
 }
开发者ID:shayanyi,项目名称:CRM,代码行数:21,代码来源:SiteController.php

示例7: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new MarketingChild();
     $name = 'MarketingChild';
     parent::create($model, $name);
 }
开发者ID:netconstructor,项目名称:X2Engine,代码行数:10,代码来源:MarketingController.php

示例8: create

 public function create($model, $oldAttributes, $api)
 {
     /* if($model->associationId=='')
               $model->associationId=0;
               //if($model->
     
               $model->createDate = time();	// created now, full datetime
               //$model->associationId=$_POST['Actions']['associationId'];
               if(!is_numeric($model->dueDate)){
               $dueDate = Formatter::parseDateTime($model->dueDate);
               $model->dueDate = ($dueDate===false)? '' : $dueDate; //date('Y-m-d',$dueDate).' 23:59:59';	// default to being due by 11:59 PM
               } */
     //if($type=='none')
     //	$model->associationId=0;
     //$model->associationType=$type;
     /* $association = $this->getAssociation($model->associationType,$model->associationId);
     
               if($association != null) {
               $model->associationName = $association->name;
               if($association->hasAttribute('lastActivity') && $api==0) {
               $association->lastActivity = time();
               $association->update(array('lastActivity'));
               }
               } else {
               $model->associationName='None';
               //$model->associationId = 0;
               }
               if($model->associationName=='None' && $model->associationType!='none'){
               $model->associationName=ucfirst($model->associationType);
               } */
     //		$this->render('test', array('model'=>$model));
     /* if($model->type != 'event' && isset($_POST['submit']) && ($_POST['submit']=='0' || $_POST['submit']=='2') && $model->calendarId == null) {	// if user clicked "New Comment" rather than "New Action"
        $model->createDate = time();
        $model->dueDate = time();
        $model->completeDate = time();
        $model->complete='Yes';
        $model->visibility='1';
        $model->assignedTo=Yii::app()->user->getName();
        $model->completedBy=Yii::app()->user->getName();
        $model->type=$_POST['submit']==2?'note':'call';
        } else if($model->type == 'event') {
        if($model->completeDate) {
        $model->completeDate = Formatter::parseDateTime($model->completeDate);
        }
        } */
     // $model->syncGoogleCalendar();
     // google sync
     /* if(!is_numeric($model->assignedTo)) { // assigned to user
        $profile = Profile::model()->findByAttributes(array('username'=>$model->assignedTo));
        if(isset($profile))
        $profile->syncActionToGoogleCalendar($model); // sync action to Google Calendar if user has a Google Calendar
        } else { // Assigned to group
        $groups = Yii::app()->db->createCommand()->select('userId')->from('x2_group_to_user')->where("groupId={$model->assignedTo}")->queryAll();
        foreach($groups as $group) {
        $profile = Profile::model()->findByPk($group['userId']);
        if(isset($profile))
        $profile->syncActionToGoogleCalendar($model);
        }
        } */
     if ($api == 0) {
         parent::create($model, $oldAttributes, $api);
     } else {
         return parent::create($model, $oldAttributes, $api);
     }
 }
开发者ID:shayanyi,项目名称:CRM,代码行数:65,代码来源:ActionsController.php

示例9: create

 public function create($model, $oldAttributes, $api)
 {
     $model->createDate = time();
     $model->lastUpdated = time();
     if ($api == 0) {
         parent::create($model, $oldAttributes, $api);
     } else {
         $lookupFields = Fields::model()->findAllByAttributes(array('modelName' => 'Contacts', 'type' => 'link'));
         foreach ($lookupFields as $field) {
             $fieldName = $field->fieldName;
             if (isset($model->{$fieldName})) {
                 $lookup = CActiveRecord::model(ucfirst($field->linkType))->findByAttributes(array('name' => $model->{$fieldName}));
                 if (isset($lookup)) {
                     $model->{$fieldName} = $lookup->id;
                 }
             }
         }
         return parent::create($model, $oldAttributes, $api);
     }
 }
开发者ID:netconstructor,项目名称:X2Engine,代码行数:20,代码来源:DefaultController.php

示例10: create

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function create($model, $oldAttributes, $api)
 {
     $model->annualRevenue = $this->parseCurrency($model->annualRevenue, false);
     $model->createDate = time();
     if ($api == 0) {
         parent::create($model, $oldAttributes, $api);
     } else {
         return parent::create($model, $oldAttributes, $api);
     }
 }
开发者ID:netconstructor,项目名称:X2Engine,代码行数:14,代码来源:DefaultController.php

示例11: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Campaign();
     if (isset($_POST['Campaign'])) {
         $oldAttributes = $model->attributes;
         $model->setX2Fields($_POST['Campaign']);
         parent::create($model, $oldAttributes, 0);
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:netconstructor,项目名称:X2Engine,代码行数:14,代码来源:DefaultController.php


注:本文中的x2base::create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。