Example #1
0
 /**
  * Get elements for add/edit form
  *
  * @param	\IPS\Content\Item|NULL	$item		The current item if editing or NULL if creating
  * @param	\IPS\Node\Model|NULL	$container	Container (e.g. forum), if appropriate
  * @return	array
  */
 public static function formElements($item = NULL, \IPS\Node\Model $container = NULL)
 {
     $return = parent::formElements($item, $container);
     $return['content'] = new \IPS\Helpers\Form\Editor('marker_description', $item ? $item->description : '', FALSE, array('app' => 'membermap', 'key' => 'markers', 'autoSaveKey' => 'custom-markers-' . ($item ? $item->id : 'new'), 'attachIds' => $item ? array($item->id) : NULL));
     $return['container'] = new \IPS\Helpers\Form\Node('marker_parent_id', ($item and $item->parent_id) ? $item->parent_id : ($container ? $container->id : 0), TRUE, array('class' => '\\IPS\\membermap\\Markers\\Groups', 'permissionCheck' => 'add', 'subnodes' => false, 'where' => array("group_type != 'member'")));
     $return['location'] = new \IPS\Helpers\Form\Text('marker_location', $item ? $item->location : '', FALSE, array(), NULL, NULL, NULL, 'marker_location');
     $return['lat'] = new \IPS\Helpers\Form\Number('marker_lat', $item ? $item->lat : 0, TRUE, array('min' => -90, 'max' => 90, 'decimals' => TRUE), NULL, NULL, NULL, 'marker_lat');
     $return['lon'] = new \IPS\Helpers\Form\Number('marker_lon', $item ? $item->lon : 0, TRUE, array('min' => -180, 'max' => 180, 'decimals' => TRUE), NULL, NULL, NULL, 'marker_lon');
     if ($item and $item->parent_id and $item->container()->type == 'member') {
         unset($return['title']);
         unset($return['container']);
     }
     return $return;
 }