Ejemplo n.º 1
0
 function destroy($params)
 {
     $params['id'] ? $clientuser = new ClientUser($params['id']) : bail('no company selected');
     $name = $clientuser->getName();
     $clientuser->destroy();
     Render::msg($name . ' Deleted.', 'bad');
     $this->redirectTo(array('controller' => 'ClientUser', 'action' => 'index'));
 }
Ejemplo n.º 2
0
 public static function date($name, $settings = array())
 {
     $content = Database::getInstance()->selectRow($settings['table'], array($settings['key'] => $settings['id']), array($settings['column']));
     if ($content) {
         $value = $content[$settings['column']];
     } else {
         $value = '';
     }
     if (ClientUser::getInstance()->isAdmin()) {
         JS::startup('lightning.cms.initDate()');
         JS::set('token', Session::getInstance()->getToken());
         return '<img src="/images/lightning/pencil.png" class="cms_edit_date icon-16" id="cms_edit_' . $settings['id'] . '">' . '<img src="/images/lightning/save.png" class="cms_save_date icon-16" id="cms_save_' . $settings['id'] . '" style="display:none">' . '<span id="cms_' . $settings['id'] . '" style="display:none">' . Time::datePop('cms_' . $settings['id'], $value, 'true', 0) . '</span>' . '<input type="hidden" id="cms_key_' . $settings['id'] . '" value="' . $settings['key'] . '" />' . '<input type="hidden" id="cms_column_' . $settings['id'] . '" value="' . $settings['column'] . '" />' . '<input type="hidden" id="cms_table_' . $settings['id'] . '" value="' . $settings['table'] . '" />';
     } else {
         return $value;
     }
 }
Ejemplo n.º 3
0
 /**
  * Generate an encrypted tracker string.
  *
  * @param string $tracker_name
  *   The tracker name.
  * @param integer|string $sub_id
  *   The tracker sub id or * if any is permitted.
  * @param $user_id
  *   The user id.
  *
  * @return string
  *   Then encrypted data.
  */
 public static function getTrackerLink($tracker_name, $sub_id = 0, $user_id = -1)
 {
     // Generate a json encoded string with the tracking data.
     $string = json_encode(array('tracker' => self::getTrackerId($tracker_name), 'sub' => $sub_id, 'user' => $user_id > -1 ? $user_id : ClientUser::getInstance()->id));
     // Encrypt the string with the public key.
     return urlencode(Encryption::aesEncrypt($string, Configuration::get('tracker.key')));
 }