Example #1
0
 function init()
 {
     parent::init();
     $this->getElement('status')->defaultValue('Draft');
     $this->getElement('created_by_id')->defaultValue($this->app->employee->id);
     $this->addCondition('type', 'SocialPost');
     $this->addExpression('total_posting')->set(function ($m, $q) {
         return $this->add('xepan\\marketing\\Model_SocialPosters_Base_SocialPosting')->addCondition('post_id', $q->getField('id'))->count();
     });
     $this->addExpression('total_visitor')->set(function ($m, $q) {
         return $this->add('xepan\\marketing\\Model_LandingResponse')->addCondition('content_id', $q->getField('id'))->count();
     });
     $this->addExpression('total_likes')->set(function ($m, $q) {
         $model_socialposting = $this->add('xepan\\marketing\\Model_SocialPosters_Base_SocialPosting');
         $model_socialposting->addCondition('post_id', $q->getField('id'));
         return $model_socialposting->sum('likes');
     });
     $this->addExpression('total_shares')->set(function ($m, $q) {
         $model_socialposting = $this->add('xepan\\marketing\\Model_SocialPosters_Base_SocialPosting');
         $model_socialposting->addCondition('post_id', $q->getField('id'));
         return $model_socialposting->sum('share');
     });
     $this->addExpression('total_comments')->set(function ($m, $q) {
         $model_socialposting = $this->add('xepan\\marketing\\Model_SocialPosters_Base_SocialPosting');
         $model_socialposting->addCondition('post_id', $q->getField('id'));
         return $model_socialposting->sum('total_comments');
     });
     $this->hasMany('xepan\\marketing\\Model_SocialPosters_Base_SocialPosting', 'post_id');
 }
Example #2
0
 function init()
 {
     parent::init();
     $this->getElement('status')->defaultValue('Draft');
     $this->addCondition('type', 'Newsletter');
     $this->getElement('content_name')->caption('Name');
     $this->getElement('title')->caption('Subject');
     $this->addExpression('total_visitor')->set(function ($m, $q) {
         return $this->add('xepan\\marketing\\Model_LandingResponse')->addCondition('content_id', $q->getField('id'))->count();
     });
     $this->is(['message_blog|required']);
     $this->addExpression('total_leads')->set(function ($m, $q) {
         return "'todo'";
     });
     $this->addExpression('send_to')->set(function ($m, $q) {
         return "'todo'";
     });
     $this->addExpression('remaining')->set(function ($m, $q) {
         return "'todo'";
     });
     $this->addExpression('name')->set($this->dsql()->expr('[0]', [$this->getElement('title')]));
 }
Example #3
0
 function init()
 {
     parent::init();
     $this->getElement('status')->defaultValue('Draft');
     $this->addCondition('type', 'Sms');
 }