/**
  * Output the widgets settings form
  */
 function form($opts)
 {
     //get default settings
     $opts = wp_parse_args((array) $opts, $this->defaults());
     $f = new WidgetForm();
     echo '<div>';
     # show title
     echo $f->text(array('name' => $this->get_field_name('title'), 'id' => $this->get_field_id('title'), 'descr' => __('Title', 'widgetKing'), 'title' => __('The title above this widget', 'widgetKing'), 'val' => esc_html($opts['title'])));
     #sort Column
     echo '<p>';
     echo $f->label_tag($this->get_field_id('orderby'), __('Sort by', 'widgetKing'), __('Sort the choosen column ASCending or DESCending.', 'widgetKing'));
     echo '<br/>';
     echo $f->select_tag($this->get_field_name('orderby'), $opts['orderby'], array('name', 'ID', 'count', 'term_group', 'slug'), $this->get_field_id('orderby'));
     echo $f->select_tag($this->get_field_name('order'), $opts['order'], array('asc', 'desc'), $this->get_field_id('order'));
     echo '</p>';
     #show category Count
     echo $f->checkbox(array('name' => $this->get_field_name('show_count'), 'id' => $this->get_field_id('show_count'), 'descr' => __('Show post counts', 'widgetKing'), 'title' => __('Show number of posts in category', 'widgetKing'), 'val' => $opts['show_count']));
     #show empty
     echo $f->checkbox(array('name' => $this->get_field_name('hide_empty'), 'id' => $this->get_field_id('hide_empty'), 'descr' => __('Hide Empty Categories', 'widgetKing'), 'title' => __('Categories without articles are not shown.', 'widgetKing'), 'val' => $opts['hide_empty']));
     # devider
     echo '</div> <h3><a href="#">' . __('Advanced', 'widgetKing') . '</a></h3> <div>';
     #exclude categories
     echo $f->text(array('name' => $this->get_field_name('exclude'), 'id' => $this->get_field_id('exclude'), 'descr' => __('Exclude Categories (1,2,3)', 'widgetKing'), 'title' => __('Comma separated list of numeric IDs to be excluded from the list. E.g: 10, 20, 30', 'widgetKing'), 'val' => $opts['exclude']));
     #show child_of
     echo $f->text(array('name' => $this->get_field_name('child_of'), 'id' => $this->get_field_id('child_of'), 'descr' => __('Show Children of Category', 'widgetKing'), 'title' => __('Show only children of this category(id).', 'widgetKing'), 'val' => $opts['child_of']));
     #show cat depth
     echo $f->text(array('name' => $this->get_field_name('depth'), 'id' => $this->get_field_id('depth'), 'descr' => __('Category tree depth', 'widgetKing'), 'title' => __('Descend to depth(number) into the category tree: 0 = All, -1 = All Flat(no indent), 1 = only top-level, n = number/levels to descend', 'widgetKing'), 'val' => $opts['depth']));
     //    #insert feed text
     echo $f->text(array('name' => $this->get_field_name('feed'), 'id' => $this->get_field_id('feed'), 'descr' => __('Show Category Feed Text', 'widgetKing'), 'title' => __('Text to display for the link to each Categorys RSS2 feed. Default is no text, and no feed displayed.', 'widgetKing'), 'val' => $opts['feed']));
     //    #name of feed image  Path/filename
     echo $f->text(array('name' => $this->get_field_name('feed_image'), 'id' => $this->get_field_id('feed_image'), 'descr' => __('Show Category Feed Image', 'widgetKing'), 'title' => __('URL Path/filename for a graphic to act as a link to each Categories RSS2 feed.Overrides the feed parameter.', 'widgetKing'), 'val' => $opts['feed_image']));
     #show show_date
     //    echo $f->checkbox(array(
     //      'name'  => $this->get_field_name('show_date'),
     //      'id'    => $this->get_field_id('show_date'),
     //      'descr' =>__('Date of the last post', 'widgetKing'),
     //      'title' => __('Sets whether to display the date of the last post in each Category.', 'widgetKing'),
     //      'val'   => $opts['show_date'] ));
     #description as title
     echo $f->checkbox(array('name' => $this->get_field_name('use_desc_for_title'), 'id' => $this->get_field_id('use_desc_for_title'), 'descr' => __('Use Description as Title', 'widgetKing'), 'title' => __('Sets whether to display the Category Description in the links title tag.', 'widgetKing'), 'val' => $opts['use_desc_for_title']));
     #list style
     echo $f->checkbox(array('name' => $this->get_field_name('style'), 'id' => $this->get_field_id('style'), 'descr' => __('Show as List (li)', 'widgetKing'), 'title' => __('Sets whether the Categories are enclosed by style points ->li', 'widgetKing'), 'val' => $opts['style']));
     #show hirachical
     echo $f->checkbox(array('name' => $this->get_field_name('hierarchical'), 'id' => $this->get_field_id('hierarchical'), 'descr' => __('Show hierarchical', 'widgetKing'), 'title' => __('Shows Categories hierarchical with sub-categories indented -> Depending on your CSS', 'widgetKing'), 'val' => $opts['hierarchical']));
     echo '</div> <h3><a href="#">' . __('Show', 'widgetKing') . '</a></h3> <div>';
     # Where To Show Options Panel
     $f->where_to_show($this, $opts['show_category'], $opts['cat_ids'], $opts['show_on_site_area'], $opts['show_not_on_site_area'], $opts['site_area'], $opts['site_area_id']);
     echo '</div> <h3><a href="#">' . __('HTML', 'widgetKing') . '</a></h3> <div>';
     # show html options
     $f->html_opts($this, $opts);
     echo '</div> <h3><a href="#">' . __('Import / Export', 'widgetKing') . '</a></h3> <div>';
     #import
     $f->export_opts($this, $opts);
     echo '</div>';
 }
Esempio n. 2
0
 /** Update a particular instance.
  *
  * This function should check that $new_opts is set correctly.
  * The newly calculated value of $opts should be returned.
  * If "false" is returned, the instance won't be saved/updated.
  *
  * @param array $new_opts New settings for this instance as input by the user via form()
  * @param array $old_opts Old settings for this instance
  * @return array Settings to save or bool false to cancel saving
  */
 function update($new_opts, $old_opts)
 {
     $opts = $old_opts;
     # use setting from json import if available
     $new_opts = !empty($new_opts["import"]) ? king_import_json($new_opts["import"]) : $new_opts;
     $opts['use_php'] = isset($new_opts["use_php"]);
     $opts['text'] = $new_opts["text"];
     WidgetForm::clean_default_opts($opts, $new_opts);
     return $opts;
 }
Esempio n. 3
0
 private function getWidgetEdit()
 {
     /*$id = $this->params()->fromRoute('id');
     		if (!$id) return $this->redirect()->toRoute('inventory', array('controller' => 'inventory', 'action' => 'index'));*/
     try {
         $repository = $this->em->getRepository($this->getMyEntity());
         $record = $repository->find($this->id);
     } catch (\Exception $ex) {
         echo $ex->getMessage();
         // this never will be seen fi you don't comment the redirect
         //return $this->redirect()->toRoute('inventory', array('controller' => 'inventory', 'action' => 'index'));
     }
     //$this->layout()->setVariable('exampleH1', $article->getName());
     $widgetForm = new WidgetForm();
     $form = $widgetForm->getForm($record, $this->em, $this->getMyEntity(), 'Сохранить');
     $form->bind($record);
     //$request = $this->getRequest();
     //if ($request->isPost()) {
     if ($this->getPost() !== null) {
         //$post = $request->getPost();
         $post = $this->getPost();
         // uncooment and fix if you want to control the date and time
         //			$post->artcCreated = $post->artcCreatedDate . ' ' . $post->artcCreatedTime;
         $form->setData($post);
         if ($form->isValid()) {
             //				$this->prepareData($article);
             $this->em->persist($record);
             $this->em->flush();
             //return $this->redirect()->toRoute($this->getController(), array('controller' => $this->getController(), 'action' => 'index', 'id' => $this->id));
             $redirect = 'index';
         }
     }
     return array('form' => $form, 'redirect' => $redirect);
 }
Esempio n. 4
0
 /** Update a particular instance.
  *
  * This function should check that $new_opts is set correctly.
  * The newly calculated value of $opts should be returned.
  * If "false" is returned, the instance won't be saved/updated.
  *
  * @param array $new_opts New settings for this instance as input by the user via form()
  * @param array $old_opts Old settings for this instance
  * @return array Settings to save or bool false to cancel saving
  */
 function update($new_opts, $old_opts)
 {
     $opts = $old_opts;
     # use setting from json import if availsable
     $new_opts = !empty($new_opts["import"]) ? king_import_json($new_opts["import"]) : $new_opts;
     # save new form values
     $opts['orderby'] = $new_opts["orderby"];
     $opts['order'] = $new_opts["order"];
     $opts['depth'] = $new_opts["depth"];
     $opts['exclude'] = stripslashes($new_opts["exclude"]);
     $opts['show_date'] = $new_opts["show_date"];
     $opts['show_date'] = $new_opts["date_format"];
     $opts['child_of'] = $new_opts["child_of"];
     WidgetForm::clean_default_opts($opts, $new_opts);
     return $opts;
 }
 protected function doSave($con = null)
 {
     $wasNew = $this->getObject()->isNew();
     parent::doSave($con);
     if ($wasNew) {
         $widget = $this->getObject();
         $petition = $widget->getPetition();
         $petition_text = $widget->getPetitionText();
         $subject = 'Validate your widget';
         $body = "Validate: VALIDATION\nEdit: EDITCODE";
         $store = StoreTable::getInstance()->findByKeyAndLanguageWithFallback(StoreTable::EMBED_WIDGET_MAIL, $petition_text->getLanguageId());
         if ($store) {
             $subject = $store->getField('subject');
             $body = $store->getField('body');
         }
         $validation = UtilLink::widgetValidation($this->getObject()->getId(), $this->getObject()->getValidationData());
         $edit_code = UtilLink::widgetEdit($this->getObject()->getId(), $this->getObject()->getEditCode());
         $from = $petition->getFrom();
         $to = $this->getObject()->getEmail();
         $additional_subst = array('VALIDATION' => $validation, 'EDITCODE' => $edit_code, '#VALIDATION-URL#' => $validation, '#EDIT-URL#' => $edit_code);
         UtilMail::sendWithSubst(null, $from, $to, $subject, $body, $petition_text, $widget, $additional_subst);
     }
 }
/*end meta tag box*/
$this->endWidget();
?>
</div>

<div class='span4'>

<?php 
/*render publish box*/
echo $this->renderPartial('form/_formPublish', array('model' => $model, 'form' => $form));
?>


  <?php 
//WidgetForm::listing($model,'Label','labels','checkbox');
WidgetForm::tree($model, 'PhotoCategory', 'photocategories', 'checkbox');
//WidgetForm::tree($model,'Category','categories','checkbox');
//WidgetForm::tagging($model,'Tag','tags'); // post model - tag model - relational name
?>


 <?php 
/*render footer box*/
echo $this->renderPartial('form/_formFooter', array('model' => $model, 'form' => $form));
?>

</div>

</div> <!--end row-->

/*end meta tag box*/
$this->endWidget();
?>
</div>

<div class='span4'>

<?php 
/*render publish box*/
echo $this->renderPartial('form/_formPublish', array('model' => $model, 'form' => $form));
?>


  <?php 
//WidgetForm::listing($model,'Label','labels','checkbox');
WidgetForm::tree($model, 'VideoCategory', 'videocategories', 'checkbox');
//WidgetForm::tree($model,'Category','categories','checkbox');
//WidgetForm::tagging($model,'Tag','tags'); // post model - tag model - relational name
?>

<?php 
/*render footer box*/
echo $this->renderPartial('form/_formFooter', array('model' => $model, 'form' => $form));
?>

</div>

</div> <!--end row-->


?>
</div>

<div class='span4'>

<?php 
echo $this->renderPartial('form/_formPublish', array('model' => $model, 'form' => $form));
?>


<?php 
// post model - term model - relational name, type ;
WidgetForm::listing($model, 'Label', 'labels', 'checkbox');
WidgetForm::listing($model, 'Topic', 'topics', 'checkbox');
WidgetForm::tree($model, 'Category', 'categories', 'checkbox');
WidgetForm::tagging($model, 'Tag', 'tags');
?>
 

<?php 
$this->beginWidget('bootstrap.widgets.TbBox', array('title' => 'Jejak'));
?>
      
<?php 
echo $form->textFieldRow($model, 'post_source', array('class' => 'span12'));
echo $form->textFieldRow($model, 'post_source_link', array('class' => 'span12', 'placeholder' => 'http://'));
$this->endWidget();
?>

</div>