Exemplo n.º 1
0
 /**
  * Prepare string from a template
  * @param type $template
  * @return type
  */
 protected function prepareString($template)
 {
     //supported placeholder : {table} {date} {row_detais}
     $details = '';
     foreach ($this->getOwner()->metadata->tableSchema->columns as $columnName => $column) {
         $details .= $columnName . '=' . $this->getOwner()->{$columnName} . ', ';
     }
     return Common::myStringReplace($template, array('{date}' => Yii::app()->localtime->fromLocalDateTime(time()), '{table}' => $this->getOwner()->tableName(), '{row_details}' => $details));
 }
Exemplo n.º 2
0
 public function sendAccActivationEmail()
 {
     $owner = $this->getOwner();
     $template = SettingsEmailTemplate::model()->getRow('*', '`key`=:t1', array(':t1' => SettingsEmailTemplate::KEY_ACCOUNT_ACTIVATION));
     if (empty($template)) {
         return FALSE;
     }
     $site_name = Yii::app()->settings->get(Constants::CATEGORY_GENERAL, Constants::KEY_SITE_NAME, Yii::app()->name);
     //placeholders: {name},{link},
     $body = Common::myStringReplace($template['body'], array('{name}' => $owner->username, '{link}' => Yii::app()->createAbsoluteUrl('auth/default/activate', array('id' => $owner->id, 'token' => $owner->activation_code))));
     MsgEmailOutbox::model()->push(array('from_name' => $site_name, 'from_email' => $template['from'], 'to_email' => $owner->email, 'subject' => $template['subject'], 'message' => $body));
 }
Exemplo n.º 3
0
 public function sendEmail()
 {
     $this->user_model->password_reset_code = Common::generateSalt();
     $this->user_model->password_reset_request_date = date('Y-m-d H:i:s');
     $this->user_model->save(false);
     $template = SettingsEmailTemplate::model()->getRow('*', '`key`=:t1', array(':t1' => SettingsEmailTemplate::KEY_FORGOT_PASSWORD));
     if (empty($template)) {
         return FALSE;
     }
     //placeholders : {name},{link}
     $body = Common::myStringReplace($template['body'], array('{name}' => Person::model()->get($this->user_model->id, 'CONCAT(first_name," ",last_name)'), '{link}' => Yii::app()->createAbsoluteUrl('auth/default/resetPassword', array('id' => $this->user_model->id, 'token' => $this->user_model->password_reset_code))));
     //$from, $this->user_model->email, $template->title, $template->body, true
     MsgEmailOutbox::model()->push(array('from_name' => Yii::app()->settings->get(Constants::CATEGORY_GENERAL, Constants::KEY_SITE_NAME, Yii::app()->name), 'from_email' => $template['from'], 'to_email' => $this->user_model->email, 'subject' => $template['subject'], 'message' => $body));
 }
Exemplo n.º 4
0
 public function run()
 {
     echo CHtml::beginForm($this->action, $this->method, $this->formHtmlOptions);
     $search_field = Common::myStringReplace($this->search_field_template, array('{{label_text}}' => Lang::t('Search'), '{{search_field}}' => CHtml::activeTextField($this->model, $this->search_field_name, $this->searchFieldHtmlOptions)));
     echo $search_field;
     echo CHtml::endForm();
 }
Exemplo n.º 5
0
 public function run()
 {
     $graph_type_filter = '';
     $date_range_filter = '';
     $filter_form = '';
     if ($this->showGraphTypeFilter) {
         $graph_type_filter = CHtml::dropDownList(HighCharts::GET_PARAM_GRAPH_TYPE, HighCharts::getGraphType(), HighCharts::graphTypes(), $this->graphTypeFilterHtmlOptions);
     }
     if ($this->showDateRangeFilter) {
         $date_range_string = $this->date_range_from . ' - ' . $this->date_range_to;
         $date_range_filter = CHtml::tag('span', array(), $date_range_string);
         $date_range_hidden = CHtml::hiddenField(HighCharts::GET_PARAM_DATE_RANGE);
         $date_range_filter_container = CHtml::tag('div', $this->dateRangeFilterHtmlOptions, $date_range_hidden . '<i class="icon-calendar icon-large"></i>&nbsp;' . $date_range_filter . '&nbsp;<b class = "caret"></b>');
     }
     if ($this->showFilter) {
         $filter_form .= CHtml::beginForm(Yii::app()->createUrl($this->owner->route, $this->owner->actionParams), 'get', $this->filterFormHtmlOptions);
         $filter_form .= Common::myStringReplace($this->filterFormTemplate, array('{graph_type}' => $graph_type_filter, '{date_range}' => $date_range_filter_container));
         $filter_form .= CHtml::hiddenField(HighCharts::GET_PARAM_HIGHCHART_FLAG, true);
         $filter_form .= CHtml::endForm();
     }
     $chart = CHtml::tag('div', array('id' => $this->chartID), '', true);
     $contents = Common::myStringReplace($this->chartTemplate, array('{filter_form}' => $filter_form, '{chart}' => $chart));
     echo CHtml::tag('div', $this->htmlOptions, $contents);
 }
Exemplo n.º 6
0
 public function renderSearchInfo()
 {
     if (!isset($_GET[self::SEARCH_GET_KEY])) {
         return FALSE;
     }
     $text = CHtml::encode($_GET[self::SEARCH_GET_KEY]);
     $search_info = Common::myStringReplace($this->search_info_template, array('{search_term}' => $text, '{count}' => number_format($this->dataProvider->getTotalItemCount())));
     echo $search_info;
 }