public function insertPoolingSchedule($contact_id, $member_id, $template_id) { $contactTarget = Contact::find($contact_id); $memberTarget = User::find($member_id); $templateTarget = EmailTemplate::where('sequence', $template_id)->first(); // return $templateTarget->id; if (!$contactTarget || !$memberTarget || !$templateTarget) { return null; } $stag = new EmailSchedullerPool(); $stag->contact_id = $contact_id; $stag->member_id = $member_id; $stag->template_id = $template_id; // $configurationMember = MemberConfiguration::where('member_id',$member_id)->where('param_code',MemberConfiguration::FOLLOW_UP_SEQUENCE)->first(); // if(!$configurationMember){ // return null ; // } // $followUpSequence = $configurationMember->param_value; $followUpSequence = Sysparam::getValue('conf_follow_up_date'); $stag->execution_date = date('Y-m-d H:i:s', strtotime("+" . $followUpSequence . " day")); $emailSchedullerPool = EmailSchedullerPool::where('member_id', $member_id)->where('contact_id', $contact_id)->where('template_id', $template_id)->first(); if ($emailSchedullerPool) { //save history $this->saveHistory("canceled", $emailSchedullerPool->member_id, $emailSchedullerPool->template_id); //delete pool $emailSchedullerPool->delete(); } //add entry if ($contactTarget->active && $memberTarget->active) { $stag->save(); return $stag->toJson(); } else { return null; } }
/** * Update the specified resource in storage. * PUT /sysparams/{id} * * @param int $id * @return Response */ public function update($id) { $sysparam = Sysparam::findOrFail($id); if ($sysparam->type == 'file') { if (Input::hasFile('content')) { if (Input::file('content')->isValid()) { $destinationPath = '/img'; // upload path $extension = Input::file('content')->getClientOriginalExtension(); // getting image extension $fileName = rand(1, 1000) . '_' . $sysparam->key . '.' . $extension; // renameing image Input::file('content')->move(public_path() . $destinationPath, $fileName); // uploading file to given path $sysparam->value->content = $destinationPath . "/" . $fileName; } else { // sending back with error message. return Redirect::back()->with('errors', 'Uploaded file is not valid')->withInput(); } } } else { $sysparam->value->content = Input::get('content'); } $sysparam->push(); return Redirect::route('admin.sysparams.index')->with("message", "Data berhasil disimpan"); }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $transaction = Yii::app()->db->beginTransaction(); try { $model = new User(); if (isset($_POST['User'])) { $model->attributes = $_POST['User']; $model->password = crypt(Sysparam::model()->findByPk(AppConstants::RESET_PASSWORD_DEFAULT)->value); if ($model->save()) { $authAssign = new AuthAssignment(); $authAssign->itemname = $model->role; $authAssign->userid = $model->nick; $authAssign->save(); $fsu = new FileSystemUtil(); $fsu->createUserTmpFoderIfNotExists($model->nick); $this->audit->logAudit(Yii::app()->user->id, new DateTime(), AppConstants::AUDIT_OBJECT_USER, AppConstants::AUDIT_OPERATION_NEW, $model->nick); $this->render('/site/successfullOperation', array('header' => 'Usuario creado con éxito', 'message' => 'Haga click en volver para regresar a la gestión de usuarios', 'returnUrl' => Yii::app()->createUrl('user/admin'), 'viewUrl' => Yii::app()->createUrl("user/view", array("id" => $model->nick)))); $transaction->commit(); return; } else { $transaction->rollback(); } } $this->render('create', array('model' => $model)); } catch (Exception $exc) { Yii::log($exc->getMessage(), DBLog::LOG_LEVEL_ERROR); $transaction->rollback(); } }
public static function getValue($key) { $collection = Sysparam::where('key', '=', $key)->get(); foreach ($collection as $object) { return $object->value->content; } }
public function run() { $array = array(['key' => 'main_logo', 'desc' => 'Logo utama dari website', 'type' => 'file'], ['key' => 'admin_email', 'desc' => 'Alamat email yang digunakan sebagai penerima berbagai notifikasi email dari website', 'type' => 'string'], ['key' => 'web_title', 'desc' => 'Judul utama dari website', 'type' => 'string'], ['key' => 'web_meta_description', 'desc' => 'Deskripsi meta dari website', 'type' => 'string'], ['key' => 'web_meta_keywords', 'desc' => 'Keyword meta dari website', 'type' => 'string'], ['key' => 'web_meta_author', 'desc' => 'Author meta dari website', 'type' => 'string'], ['key' => 'post_default_pic', 'desc' => 'Default gambar yang ditampilkan untuk post yang tidak memiliki gambar', 'type' => 'file'], ['key' => 'master_web_dashboard', 'desc' => 'Default Link Master GNT Dashboard (GNT CLUB)', 'type' => 'string'], ['key' => 'conf_follow_up_date', 'desc' => 'Durasi Follow-up email untuk kontak', 'type' => 'string'], ['key' => 'web_replika', 'desc' => 'microsite for user access in website format: (<url aops>/<username>)', 'type' => 'string']); foreach ($array as $item) { Sysparam::create($item); } $array = array(['sysparam_key_id' => '1', 'content' => 'img/logo_white.png'], ['sysparam_key_id' => '2', 'content' => '*****@*****.**'], ['sysparam_key_id' => '3', 'content' => 'GNT Club'], ['sysparam_key_id' => '4', 'content' => 'GNT Club System'], ['sysparam_key_id' => '5', 'content' => 'gnt'], ['sysparam_key_id' => '6', 'content' => 'PT. Guna Natur Tulen'], ['sysparam_key_id' => '7', 'content' => 'img/default-pic.jpg'], ['sysparam_key_id' => '8', 'content' => 'http://localhost/aops-client/login.php'], ['sysparam_key_id' => '9', 'content' => '3'], ['sysparam_key_id' => '10', 'content' => 'http://localhost/gnt-aops/public/@']); foreach ($array as $item) { Sysparamvalue::create($item); } }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new User(); if (isset($_POST['User'])) { $model->attributes = $_POST['User']; $model->password = crypt(Sysparam::model()->findByPk(Constants::PARAMETRO_CONTRASENIA_REINICIO)->value); if ($model->save()) { $authAssign = new AuthAssignment(); $authAssign->itemname = $model->role; $authAssign->userid = $model->nick; $authAssign->save(); $fsu = new FileSystemUtil(); $fsu->createUserTmpFoderIfNotExists($model->nick); $this->audit->logAudit(Yii::app()->user->id, new DateTime(), Constants::AUDITORIA_OBJETO_USUARIO, Constants::AUDITORIA_OPERACION_ALTA, $model->nick); $this->render('/site/successfullOperation', array('header' => 'Usuario creado con éxito', 'message' => 'Haga click en volver para regresar a la gestión de usuarios', 'returnUrl' => Yii::app()->createUrl('user/admin'), 'viewUrl' => Yii::app()->createUrl("user/view", array("id" => $model->nick)))); return; } } $this->render('create', array('model' => $model)); }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return Sysparam the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Sysparam::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public function resetPassword() { $defPassword = Sysparam::model()->findByPk(AppConstants::PARAMETRO_CONTRASENIA_REINICIO); $this->password = crypt($defPassword->value); }
public function getPropertyFolder($idInmueble) { $rutaBase = Sysparam::model()->findByPk(Constants::PARAMETRO_RUTA_BASE)->value; return join(DIRECTORY_SEPARATOR, array($rutaBase, FileSystemUtil::IMAGES_FOLDER_NAME, $idInmueble)); }