Exemple #1
0
 /**
  * @param $sender_id Отправитель
  * @param $receiver_id Получатель
  * @param $text Текст
  */
 public static function createMessage($sender_id, $receiver_id, $text)
 {
     $message = new this();
     $message->sender_id = $sender_id;
     $message->receiver_id = $receiver_id;
     $message->text = $text;
     $message->save();
 }
 public function __construct($name, $title = null, $value = '')
 {
     this::__construct('cms', $name, $title, $value);
     $this->setConfigName("cms");
     //it's safe to call it again in here, just in case it's used outside of LeftAndMain layout - by giving the customScript a name we do ensure, that it's only included once
     self::include_js();
 }
 function thisMonthSupplyPrecentage()
 {
     $arr = this::factoryTotalSupplyOf12Months();
     $val = this::getThisMonthTotalSupply();
     $count = 0;
     for ($i = 0; $i < 12; $i++) {
         $count = $count + $arr[$i] * 1;
     }
     $count = $val / $count * 100;
     return round($count, 2);
 }
Exemple #4
0
 public static function log($msg)
 {
     global $config;
     if (is_null(self::$runid)) {
         self::$runid = uniqid("AP");
         ini_set("log_errors_max_len", 0);
     }
     error_log("{$config->real_user->username}::{$config->alias_user->username}::{$config->application['uid']}::" . self::$runid . "::{$msg}");
 }
Exemple #5
0
 /**
  * Returns the name of the tag
  *
  * @return string
  */
 function name()
 {
     return strtolower(this::class_name());
 }
Exemple #6
0
 public function getParent()
 {
     return this::load($this->parentID);
 }
Exemple #7
0
function app_event_test_items_list($page, $values)
{
    global $config;
    $files = array(array('filename' => 'Generic.pdf', 'uuid' => uniqid()), array('filename' => 'Trancript.pdf', 'uuid' => uniqid()), array('filename' => 'Long Name with Long Letter.pdf', 'uuid' => uniqid()), array('filename' => 'Presentation.ppt', 'uuid' => uniqid()), array('filename' => 'Generic Document.doc', 'uuid' => uniqid()), array('filename' => 'File.tiff', 'uuid' => uniqid()), array('filename' => 'test.css', 'uuid' => uniqid()));
    $list = new ctrl_items_list();
    $list->setProperty('width', '900px');
    $list->setProperty('height', '400px');
    $actions = array('view' => array('caption' => 'View...', 'icon' => 'edit', 'url' => this::actionLink('test_items_list', array('id' => '%id%', 'uid' => '%uid%'))), 'download' => array('caption' => 'Download...', 'icon' => 'cloud-download', 'url' => this::actionLink('test_items_list', array('id' => '%id%', 'uid' => '%uid%'))));
    $test_template = "";
    $test_template .= '<a href="#" class="list-group-item" data-owner="%owner_uid%" data-uid="%uid%">';
    $test_template .= "<span class='badge'>%img%</span><h4 class='list-group-item-heading' title='%caption%'>%caption%</h4>";
    $test_template .= "<p class='list-group-item-text'>%details%</p>";
    $test_template .= "</a>";
    $list->setItemTemplate($test_template);
    $list->setItemDefaultAction($actions['view']);
    $list->setItemActions($actions);
    $actions['view']['caption'] = 'Test Add';
    $list->setItemPlusActions($actions);
    $list->setItemPlusAction($actions['view']);
    $add = array('caption' => 'Add new...', 'uid' => uniqid(), 'icon' => 'plus', 'details' => '');
    $list->addItem($add);
    $cfg_ext_icons = array('png' => 'picture-o', 'jpg' => 'picture-o', 'jpeg' => 'picture-o', 'bmp' => 'picture-o', 'tiff' => 'picture-o', 'css' => 'css3', 'mov' => 'youtube-play', 'wma' => 'youtube-play', 'mp4' => 'youtube-play', 'mp3' => 'music', 'ogg' => 'music', 'pdf' => 'file-o', 'txt' => 'file-text-o', 'doc' => 'file-text-o', 'docx' => 'file-text-o', 'xls' => 'table', 'xlsx' => 'table', 'ppt' => 'list-alt', 'pptx' => 'list-alt', 'key' => 'list-alt', 'pages' => 'file');
    foreach ($files as $file) {
        $view_lnk = '';
        $down_lnk = '';
        $p = explode('.', $file['filename']);
        $ext = array_pop($p);
        $icon = 'pencil';
        if (array_key_exists($ext, $cfg_ext_icons)) {
            $icon = $cfg_ext_icons[$ext];
        }
        $e = array('caption' => $file['filename']);
        $e['uid'] = $file['uuid'];
        $e['uid'] = $file['uuid'];
        $e['icon'] = $icon;
        $e['details'] = '';
        $e['view_action'] = $view_lnk;
        $e['download_action'] = $down_lnk;
        //$e['']
        $list->addItem($e);
    }
    $body->main->write($list);
    $page->write($body);
}
Exemple #8
0
 public static function basereadir()
 {
     $baseDir = dirname(this::basedir()) . '/rea/';
     return $baseDir;
 }
 public function byUser($user)
 {
     return this::where('user_id', $user)->get();
 }