/** * Check widget's posted data and return data to be stored or errors to be displayed */ public function grid() { $widgetId = ipRequest()->getQuery('widgetId'); ipAddCss('assets/masonryManagement.css'); $config = Config::grid(); if (!empty($widgetId)) { $config['filter'] = ' `widgetId` = ' . (int) $widgetId; $config['gatewayData'] = array('widgetId' => $widgetId); } return ipGridController($config); }
public function comments() { $langs = ipContent()->getLanguages(); $langs_values = array(); if (!empty($langs)) { foreach ($langs as $key => $val) { $langs_values[] = array($val->getId(), $val->getTitle()); } } $config = array('title' => __('Comments', 'Comments'), 'table' => 'comments', 'deleteWarning' => __('Do you really want to delete this item?', 'Comments'), 'sortField' => 'createdAt', 'sortDirection' => 'desc', 'createPosition' => 'top', 'pageSize' => 6, 'fields' => array(array('label' => __('Page I', 'ClassesEnroll'), 'type' => 'Tab'), array('label' => __('Page', 'Comments'), 'field' => 'zone_name', 'validators' => array('Required')), array('label' => __('User Id', 'Comments'), 'field' => 'user_id', 'preview' => false), array('label' => __('Name', 'Comments'), 'field' => 'name', 'validators' => array('Required')), array('label' => __('Email', 'Comments'), 'field' => 'email', 'validators' => array('Required', 'Email')), array('label' => __('Page II', 'ClassesEnroll'), 'type' => 'Tab'), array('label' => __('Link', 'Comments'), 'field' => 'link', 'preview' => false), array('type' => 'Textarea', 'label' => __('Comment', 'Comments'), 'field' => 'text', 'validators' => array('Required'), 'preview' => false), array('label' => __('IP', 'Comments'), 'field' => 'ip', 'validators' => array('Required'), 'preview' => false), array('label' => __('Modified at', 'Comments'), 'field' => 'modifiedAt', 'allowCreate' => false, 'allowUpdate' => true, 'preview' => false, 'transformations' => array('\\Plugin\\Comments\\Transformation\\MySqlTimestampNow')), array('label' => __('Page III', 'ClassesEnroll'), 'type' => 'Tab'), array('type' => 'Select', 'label' => __('Approved', 'Comments'), 'field' => 'approved', 'values' => array(array('0', 'No'), array('1', 'Yes')), 'validators' => array('Required')), array('label' => __('Session', 'Comments'), 'field' => 'session_id', 'validators' => array('Required'), 'allowCreate' => true, 'allowUpdate' => false, 'defaultValue' => '1-internal', 'preview' => false), array('label' => __('Verification Code', 'Comments'), 'field' => 'verification_code', 'validators' => array('Required'), 'allowCreate' => true, 'allowUpdate' => false, 'defaultValue' => '1-internal', 'preview' => false), array('type' => 'Select', 'label' => __('Active', 'Comments'), 'field' => 'active', 'values' => array(array('0', 'No'), array('1', 'Yes')), 'validators' => array('Required')), array('type' => 'Select', 'label' => __('Language', 'Comments'), 'field' => 'language_id', 'values' => $langs_values, 'validators' => array('Required'), 'preview' => false))); $config = ipFilter('Comments_commentsConfig', $config); return ipGridController($config); }