/**
  * WYSIWYGの初期処理
  *
  * @param string $fieldName フィールド名("Modelname.fieldname"形式)
  * @param array $attributes HTML属性のオプション配列
  * @return string WYSIWYGのHTML
  */
 public function wysiwyg($fieldName, $attributes = array())
 {
     $ngModel = Hash::expand(array($fieldName => 0));
     $ngModel = NetCommonsAppController::camelizeKeyRecursive($ngModel);
     $ngModel = Hash::flatten($ngModel);
     $ngModel = array_flip($ngModel);
     $defaultAttributes = array('type' => 'textarea', 'ui-tinymce' => 'tinymce.options', 'ng-model' => $ngModel[0], 'rows' => 10);
     $attributes = Hash::merge($defaultAttributes, $attributes);
     // wysiwygに関連する js読み込みを Wysiwygプラグインから行う
     $html = '';
     $html .= $this->wysiwygScript();
     $html .= $this->NetCommonsForm->input($fieldName, $attributes);
     return $html;
 }
Exemple #2
0
 /**
  * 特定のブロックを表示する選択ボックス群の初期処理
  *
  * @return string HTML出力
  */
 public function initSelectBlock()
 {
     $selectBlocks = NetCommonsAppController::camelizeKeyRecursive($this->_View->viewVars['selectBlocks']);
     $topicFramesBlock['topicFramesBlock'] = NetCommonsAppController::camelizeKeyRecursive($this->_View->request->data['TopicFramesBlock']);
     $html = 'initBlocks(' . h(json_encode($selectBlocks, true)) . ', ' . h(json_encode($topicFramesBlock, true)) . ')';
     return $html;
 }