Beispiel #1
0
 /**
  * 
  * @param array $element
  * @return array
  */
 public static function renderHtmlInput(array $element)
 {
     $notificationWays = NotificationWayRepository::getNotificationWays();
     $contactId = $element['label_extra']['id'];
     $currentNotificationWays = ContactRepository::getContactInfo($contactId, false);
     $tpl = Di::getDefault()->get('template');
     $tpl->addCss('select2.css')->addCss('select2-bootstrap.css');
     $tpl->addJs('jquery.select2/select2.min.js')->addJs('centreon-clone.js')->addJs('component/notificationWay.js');
     $tpl->assign('notificationWays', $notificationWays);
     $tpl->assign('currentNotificationWays', $currentNotificationWays);
     return array('html' => $tpl->fetch('file:[Core]/form/component/notificationway.tpl'));
 }
 /**
  * 
  * @param array $givenParameters
  * @return integer
  */
 public static function create($givenParameters, $origin = "wizard", $route = "", $validate = true, $validateMandatory = true)
 {
     if (isset($givenParameters['password']) && $givenParameters['password']) {
         $givenParameters['password2'] = static::generateHashedPassword($givenParameters);
     }
     $currentDate = date('Y-m-d H:i:s');
     $givenParameters['createdat'] = $currentDate;
     $givenParameters['updatedat'] = $currentDate;
     $userId = parent::create($givenParameters, $origin, $route, $validate, $validateMandatory);
     $contactId = ContactRepository::create(array('description' => $givenParameters['login'] . " contact"), $origin, $route, false, false);
     parent::update(array('object_id' => $userId, 'contact_id' => $contactId), $origin, $route, false, false);
     return $userId;
 }