/**
  * Construct records into data array to display in view
  */
 public function before()
 {
     // set data to display in view
     foreach ($this->_records as $row) {
         $this->data[] = ['id' => $row->id, 'title' => $row->getLocaled('title'), 'date' => Date::convertToDatetime($row->created_at, Date::FORMAT_TO_HOUR)];
     }
 }
Exemple #2
0
 /**
  * Upload files from ckeditor
  * @param string $type
  * @return string
  * @throws NativeException
  * @throws \Ffcms\Core\Exception\SyntaxException
  */
 public function actionUpload($type)
 {
     /** @var $loadFile \Symfony\Component\HttpFoundation\File\UploadedFile */
     $loadFile = App::$Request->files->get('upload');
     if ($loadFile === null || $loadFile->getError() !== 0) {
         return $this->errorResponse(__('File upload failed'));
     }
     // get file extension
     $fileExt = '.' . $loadFile->guessExtension();
     // check if this request type is allowed
     if ($this->allowedExt[$type] === null || !Obj::isArray($this->allowedExt[$type])) {
         throw new NativeException('Hack attempt');
     }
     // check if this file extension is allowed to upload
     if (!Arr::in($fileExt, $this->allowedExt[$type])) {
         return $this->errorResponse(__('This file type is not allowed to upload'));
     }
     $date = Date::convertToDatetime(time(), 'd-m-Y');
     // create file hash based on name-size
     $fileNewName = App::$Security->simpleHash($loadFile->getFilename() . $loadFile->getSize()) . $fileExt;
     $savePath = Normalize::diskFullPath('/upload/' . $type . '/' . $date);
     // save file from tmp to regular
     $loadFile->move($savePath, $fileNewName);
     // generate URI of uploaded file
     $url = '/upload/' . $type . '/' . $date . '/' . $fileNewName;
     return App::$View->render('editor/load_success', ['callbackId' => (int) App::$Request->query->get('CKEditorFuncNum'), 'url' => $url], __DIR__);
 }
Exemple #3
0
 /**
  * Prepare output comment post information array
  * @return array|null
  */
 public function make()
 {
     if ($this->_record === null) {
         return null;
     }
     // build user data
     $userName = __('Unknown');
     $userAvatar = App::$Alias->scriptUrl . '/upload/user/avatar/small/default.jpg';
     $userObject = $this->_record->getUser();
     if ($userObject !== null) {
         $userName = $userObject->getProfile()->getNickname();
         $userAvatar = $userObject->getProfile()->getAvatarUrl('small');
     } else {
         if (!Str::likeEmpty($this->_record->guest_name)) {
             $userName = App::$Security->strip_tags($this->_record->guest_name);
         }
     }
     // return output json data
     $res = ['type' => $this->_type, 'id' => $this->_record->id, 'text' => $this->_record->message, 'date' => Date::convertToDatetime($this->_record->created_at, Date::FORMAT_TO_HOUR), 'pathway' => $this->_record->pathway, 'moderate' => (int) $this->_record->moderate, 'user' => ['id' => $this->_record->user_id, 'name' => $userName, 'avatar' => $userAvatar]];
     if ($this->_type === 'post' && method_exists($this->_record, 'getAnswerCount') && $this->_calcAnswers) {
         $res['answers'] = $this->_record->getAnswerCount();
     } elseif ($this->_type === 'answer') {
         $res['comment_id'] = $this->_record->comment_id;
     }
     return $res;
 }
Exemple #4
0
 /**
  * Build sitemap index files information - location, last modify time
  */
 public function make()
 {
     if (!Obj::isArray($this->files)) {
         return;
     }
     // build file information data
     foreach ($this->files as $file) {
         $this->info[] = ['loc' => App::$Alias->scriptUrl . $file, 'lastmod' => Date::convertToDatetime(File::mTime($file), 'c')];
     }
 }
Exemple #5
0
 /**
  * Add uri/url item to sitemap builder
  * @param string $uri
  * @param int|string $lastmod
  * @param string $freq
  * @param float $priority
  */
 public function add($uri, $lastmod, $freq = 'weekly', $priority = 0.5)
 {
     // generate multi-language files
     if ($this->langs !== null && Obj::isArray($this->langs) && count($this->langs) > 0) {
         foreach ($this->langs as $lang) {
             // set data to local attribute
             $this->data[$lang][] = ['uri' => Url::standaloneUrl($uri, $lang), 'lastmod' => Date::convertToDatetime($lastmod, 'c'), 'freq' => (string) $freq, 'priority' => (double) $priority];
         }
     } else {
         // only one language, multilanguage is disabled
         $this->data[App::$Properties->get('singleLanguage')][] = ['uri' => Url::standaloneUrl($uri), 'lastmod' => Date::convertToDatetime($lastmod, 'c'), 'freq' => (string) $freq, 'priority' => (double) $priority];
     }
 }
Exemple #6
0
 /**
  * Save data after validation
  */
 public function save()
 {
     $profile = $this->_user->getProfile();
     $profile->nick = $this->nick;
     $profile->sex = $this->sex;
     $newBirthday = Date::convertToDatetime($this->birthday, Date::FORMAT_SQL_DATE);
     if (false !== $newBirthday) {
         $profile->birthday = $newBirthday;
     }
     $profile->city = $this->city;
     $profile->hobby = $this->hobby;
     $profile->phone = $this->phone;
     $profile->url = $this->url;
     $profile->custom_data = $this->custom_data;
     $profile->save();
 }
Exemple #7
0
 /**
  * Magic method before
  */
 public function before()
 {
     // get full name of update object
     $class = 'Apps\\Controller\\Admin\\' . $this->_record->sys_name;
     if (class_exists($class)) {
         $this->_callback = $class;
     } else {
         throw new NotFoundException(__('Admin controller is not founded - %c%', ['c' => $this->_record->sys_name]));
     }
     // compare versions
     if ($this->_record->checkVersion() === true) {
         throw new ForbiddenException('Extension is not be updated - version comparing done successful');
     }
     // set public attributes to display
     $this->name = $this->_record->getLocaleName();
     $this->dbVersion = $this->_record->version;
     $this->scriptVersion = $this->_record->getScriptVersion();
     $this->date = Date::convertToDatetime($this->_record->updated_at, Date::FORMAT_TO_HOUR);
 }
Exemple #8
0
 /**
  * Find latest release in github API and get required info
  */
 private function findLatestVersion()
 {
     // get remote api with json response
     $gitJson = File::getFromUrl(static::API_LATEST_RELEASE);
     if ($gitJson === null || $gitJson === false) {
         return;
     }
     // parse api response to model attributes
     $git = json_decode($gitJson, true);
     $this->lastVersion = $git['tag_name'];
     // get download url to full compiled distributive (uploaded to each release as .zip archive, placed in release.assets)
     $download = null;
     if (Obj::isArray($git['assets'])) {
         foreach ($git['assets'] as $asset) {
             if ($asset['content_type'] === 'application/zip' && $asset['state'] === 'uploaded') {
                 $download = $asset['browser_download_url'];
             }
         }
     }
     $this->lastInfo = ['name' => $git['name'], 'created_at' => Date::convertToDatetime($git['published_at'], Date::FORMAT_TO_HOUR), 'download_url' => $download];
 }
Exemple #9
0
$this->breadcrumbs = [Url::to('main/index') => __('Main'), Url::to('application/index') => __('Applications'), __('User list')];
?>

<?php 
echo $this->render('user/_tabs');
?>

<h1><?php 
echo __('User list');
?>
</h1>
<hr />
<?php 
$items = [];
foreach ($records as $user) {
    $items[] = [1 => ['text' => $user->id], 2 => ['text' => $user->email], 3 => ['text' => $user->login], 4 => ['text' => $user->getRole()->name], 5 => ['text' => Date::convertToDatetime($user->created_at, Date::FORMAT_TO_DAY)], 6 => ['text' => Url::link(['user/update', $user->id], '<i class="fa fa-pencil fa-lg"></i>') . Url::link(['user/delete', $user->id], ' <i class="fa fa-trash-o fa-lg"></i>'), 'html' => true, 'property' => ['class' => 'text-center']], 'property' => ['class' => 'checkbox-row' . ($user->approve_token != '0' ? ' alert-warning' : null)]];
}
?>

<div class="pull-right">
    <?php 
echo Url::link(['user/invite'], __('Send invite'), ['class' => 'btn btn-primary']);
?>
    <?php 
echo Url::link(['user/update', '0'], __('Add user'), ['class' => 'btn btn-primary']);
?>
</div>

<?php 
echo Table::display(['table' => ['class' => 'table table-bordered'], 'thead' => ['titles' => [['text' => '#'], ['text' => __('Email')], ['text' => __('Login')], ['text' => __('Role')], ['text' => __('Register date')], ['text' => __('Actions')]]], 'tbody' => ['items' => $items], 'selectableBox' => ['attachOrder' => 1, 'form' => ['method' => 'GET', 'class' => 'form-horizontal', 'action' => Url::to('user/delete')], 'selector' => ['type' => 'checkbox', 'name' => 'selected[]', 'class' => 'massSelectId'], 'buttons' => [['type' => 'submit', 'class' => 'btn btn-danger', 'value' => __('Delete selected')]]]]);
?>
Exemple #10
0
?>

<h2><?php 
echo __('List of blocked users');
?>
</h2>
<hr />
<?php 
if ($records !== null && $records->count() > 0) {
    ?>
    <?php 
    $items = [];
    foreach ($records as $row) {
        $userProfile = $row->getUser()->getProfile();
        $userNick = \Ffcms\Core\Helper\Simplify::parseUserNick($userProfile->user_id, __('No name'));
        $items[] = [['text' => Url::link(['profile/show', $row->target_id], $userNick, ['target' => '_blank']), 'html' => true], ['text' => $row->comment], ['text' => Date::convertToDatetime($row->created_at, Date::FORMAT_TO_DAY)], ['text' => Url::link(['profile/unblock', $row->target_id], '<i class="fa fa-times"></i>'), 'html' => true, 'property' => ['class' => 'text-center']]];
    }
    ?>


    <?php 
    echo Table::display(['table' => ['class' => 'table table-bordered'], 'thead' => ['titles' => [['text' => __('User')], ['text' => __('Comment')], ['text' => __('Add date')], ['text' => __('Actions')]]], 'tbody' => ['items' => $items]]);
    ?>
    <div class="text-center">
        <?php 
    echo $pagination->display(['class' => 'pagination pagination-centered']);
    ?>
    </div>
<?php 
} else {
    ?>
Exemple #11
0
echo $this->render('user/_tabs');
?>

<h1><?php 
echo __('Delete users');
?>
</h1>
<hr />
<p><?php 
echo __('Are you sure to delete this users?');
?>
</p>
<?php 
$items = [];
foreach ($model->users as $user) {
    /** @var \Apps\ActiveRecord\User $user */
    $items[] = [['text' => $user->getParam('id')], ['text' => $user->getParam('email')], ['text' => $user->getParam('login')], ['text' => $user->getProfile()->getNickname()], ['text' => Date::convertToDatetime($user->created_at, Date::FORMAT_TO_HOUR)]];
}
?>

<?php 
echo Table::display(['table' => ['class' => 'table table-bordered'], 'thead' => ['titles' => [['text' => '#'], ['text' => __('Email')], ['text' => __('Login')], ['text' => __('Nickname')], ['text' => __('Register date')]]], 'tbody' => ['items' => $items]]);
?>


<?php 
$form = new Form($model, ['class' => 'form-horizontal', 'method' => 'post', 'action' => '']);
echo $form->start();
echo $form->submitButton(__('Delete'), ['class' => 'btn btn-danger']) . "&nbsp;";
echo Url::link(['user/index'], __('Cancel'), ['class' => 'btn btn-default']);
echo $form->finish();
Exemple #12
0
?>
</h2>
<?php 
foreach ($answers->get() as $answer) {
    /** @var \Apps\ActiveRecord\CommentAnswer $answer */
    ?>
<div class="panel panel-default" id="answer-<?php 
    echo $answer->id;
    ?>
">
    <div class="panel-heading">
        <?php 
    $answerAuthor = Simplify::parseUserLink($answer->user_id, $answer->guest_name, 'user/update');
    ?>
        <?php 
    echo $answerAuthor . ', ' . Date::convertToDatetime($answer->created_at, Date::FORMAT_TO_HOUR);
    ?>
        <div class="pull-right">
            <?php 
    if ((bool) $answer->moderate) {
        ?>
        		<?php 
        echo Url::link(['comments/publish', 'answer', $answer->id], __('Publish'), ['class' => 'label label-warning']);
        ?>
        	<?php 
    }
    ?>
            <?php 
    echo Url::link(['comments/edit', 'answer', $answer->id], __('Edit'), ['class' => 'label label-primary']);
    ?>
            <?php 
Exemple #13
0
?>

<h1><?php 
echo __('Content publish');
?>
</h1>
<hr />
<p><?php 
echo __('Are you sure to make this item public?');
?>
</p>
<?php 
$items = [];
foreach ($records as $record) {
    /** @var $record \Apps\ActiveRecord\Content */
    $items[] = [['text' => $record->id], ['text' => $record->getLocaled('title')], ['text' => Simplify::parseUserLink($record->author_id), 'html' => true], ['text' => Date::convertToDatetime($record->created_at, Date::FORMAT_TO_HOUR)]];
}
?>

<div class="table-responsive">
    <?php 
echo Table::display(['table' => ['class' => 'table table-bordered'], 'thead' => ['titles' => [['text' => '#'], ['text' => __('Title')], ['text' => __('Author')], ['text' => __('Date')]]], 'tbody' => ['items' => $items]]);
?>
</div>

<?php 
$form = new Form($model, ['class' => 'form-horizontal']);
echo $form->start();
?>

<?php 
Exemple #14
0
 /**
  * Cleanup old invites
  */
 public static function clean()
 {
     $date = time() - self::TOKEN_VALID_TIME;
     $timestamp = Date::convertToDatetime($date, Date::FORMAT_SQL_TIMESTAMP);
     self::where('created_at', '<=', $timestamp)->delete();
 }
Exemple #15
0
            <div class="text-center"><img src="<?php 
    echo $profile->getAvatarUrl('small');
    ?>
" class="img-responsive img-circle img-thumbnail"/></div>
        </div>
        <div class="col-md-8">
            <h3>
                <?php 
    echo Url::link(['profile/show', $profile->user_id], Str::likeEmpty($profile->nick) ? __('No name') . '(id' . $profile->user_id . ')' : $profile->nick);
    ?>
            </h3>
            <p><?php 
    echo __('Registered');
    ?>
: <?php 
    echo Date::convertToDatetime($profile->created_at, Date::FORMAT_TO_DAY);
    ?>
</p>
            <?php 
    if (\App::$User->identity() !== null && $profile->user_id !== \App::$User->identity()->getId()) {
        ?>
                <?php 
        echo Url::link(['profile/messages', null, null, ['newdialog' => $profile->user_id]], '<i class="fa fa-pencil-square-o"></i> ' . __('New message'), ['class' => 'btn btn-info']);
        ?>
            <?php 
    }
    ?>
        </div>
        <div class="col-md-2">
            <div class="h3 pull-right">
                <?php 
Exemple #16
0
 /**
  * Install function callback
  */
 public static function install()
 {
     // prepare application information to extend inserted before row to table apps
     $appData = new \stdClass();
     $appData->configs = ['textCfg' => 'Some value', 'intCfg' => 10, 'boolCfg' => true];
     $appData->name = ['ru' => 'Демо приложение', 'en' => 'Demo app'];
     // get current app row from db (like SELECT ... WHERE type='app' and sys_name='Demoapp')
     $query = AppRecord::where('type', '=', 'app')->where('sys_name', '=', 'Demoapp');
     if ($query->count() !== 1) {
         return;
     }
     $query->update(['name' => Serialize::encode($appData->name), 'configs' => Serialize::encode($appData->configs), 'disabled' => 0]);
     // create your own table in database
     App::$Database->schema()->create('demos', function ($table) {
         $table->increments('id');
         $table->string('text', 1024);
         $table->timestamps();
     });
     $now = Date::convertToDatetime(time(), Date::FORMAT_SQL_DATE);
     // insert some data in table, id|text columns, id is autoincrement
     App::$Database->connection()->table('demos')->insert([['text' => 'Hello world 1', 'created_at' => $now, 'updated_at' => $now], ['text' => 'Hello world 2', 'created_at' => $now, 'updated_at' => $now]]);
 }
Exemple #17
0
<?php

use Ffcms\Core\Helper\Date;
use Ffcms\Core\Helper\HTML\Table;
use Ffcms\Core\Helper\Url;
/** @var \Apps\ActiveRecord\FeedbackPost|\Apps\ActiveRecord\FeedbackAnswer $record */
/** @var \Apps\Model\Admin\Feedback\FormAnswerAdd|null $model */
$this->title = __('Feedback delete');
$this->breadcrumbs = [Url::to('main/index') => __('Main'), Url::to('application/index') => __('Applications'), Url::to('feedback/index') => __('Feedback'), __('Delete message')];
echo $this->render('feedback/_tabs');
?>
<h1><?php 
echo __('Delete feedback message');
?>
</h1>
<hr />
<div class="table-responsive">
    <?php 
echo Table::display(['table' => ['class' => 'table table-bordered'], 'tbody' => ['items' => [[['text' => __('Sender')], ['text' => $record->name . ' (' . $record->email . ')']], [['text' => __('Date')], ['text' => Date::convertToDatetime($record->created_at, Date::FORMAT_TO_HOUR)]], [['text' => __('Message')], ['text' => $record->message]]]]]);
?>
</div>
<form action="" method="post">
    <input type="submit" name="deleteFeedback" value="<?php 
echo __('Delete');
?>
" class="btn btn-danger" />
    <?php 
echo Url::link(['feedback/index'], __('Cancel'), ['class' => 'btn btn-default']);
?>
</form>
Exemple #18
0
            </div>
        </div>
    </div>
<?php 
$widgetTableItems = null;
foreach ($widgets as $widget) {
    /** @var $widget Apps\ActiveRecord\App */
    $route = $widget->sys_name . '/index';
    $icoStatus = null;
    $actions = $this->render('native/macro/widget_actions', ['controller' => $widget->sys_name]);
    if ((int) $widget->disabled !== 0) {
        $icoStatus = ' <i class="fa fa-pause" style="color: #ff0000;"></i>';
    } elseif ($widget->checkVersion() !== true) {
        $icoStatus = ' <i class="fa fa-exclamation" style="color: #ffbd26;"></i>';
        $actions = Url::link(['widget/update', $widget->sys_name], '<i class="fa fa-wrench"></i>');
    } else {
        $icoStatus = ' <i class="fa fa-check" style="color: #008000;"></i>';
    }
    $widgetTableItems[] = [['text' => $widget->id . $icoStatus, 'html' => true, '!secure' => true], ['text' => Url::link([$route], $widget->getLocaleName()), 'html' => true], ['text' => $widget->version], ['text' => Date::convertToDatetime($widget->updated_at, Date::FORMAT_TO_HOUR)], ['text' => $actions, 'property' => ['class' => 'text-center'], 'html' => true]];
}
?>

<?php 
if ($widgetTableItems === null || count($widgetTableItems) < 1) {
    echo '<p class="alert alert-info">' . __('Installed widgets is not founded') . '</p>';
}
?>


<?php 
echo Table::display(['table' => ['class' => 'table table-bordered'], 'thead' => ['titles' => [['text' => '#'], ['text' => __('Widget')], ['text' => __('Version')], ['text' => __('Activity')], ['text' => __('Actions')]]], 'tbody' => ['items' => $widgetTableItems]]);
Exemple #19
0
use Ffcms\Core\Helper\Type\Str;
use Ffcms\Core\Helper\Url;
$this->title = __('Profile list');
$this->breadcrumbs = [Url::to('main/index') => __('Main'), Url::to('application/index') => __('Applications'), __('Profile')];
?>

<?php 
echo $this->render('profile/_tabs');
?>

<h1><?php 
echo __('Profile list');
?>
</h1>
<hr />
<?php 
$items = [];
foreach ($records as $profile) {
    $items[] = [['text' => $profile->id], ['text' => $profile->User()->login . '/' . $profile->User()->email], ['text' => $profile->nick], ['text' => Str::startsWith('0000-', $profile->birthday) ? __('None') : Date::convertToDatetime($profile->birthday)], ['text' => ($profile->rating > 0 ? '+' : null) . $profile->rating], ['text' => Url::link(['profile/update', $profile->id], '<i class="fa fa-pencil fa-lg"></i> ') . Url::link(['user/delete', $profile->User()->id], '<i class="fa fa-trash-o fa-lg"></i>'), 'html' => true, 'property' => ['class' => 'text-center']]];
}
?>

<?php 
echo Table::display(['table' => ['class' => 'table table-bordered'], 'thead' => ['titles' => [['text' => 'id'], ['text' => 'login/email'], ['text' => __('Nickname')], ['text' => __('Birthday')], ['text' => __('Rating')], ['text' => __('Actions')]]], 'tbody' => ['items' => $items]]);
?>

<div class="text-center">
    <?php 
echo $pagination->display(['class' => 'pagination pagination-centered']);
?>
</div>
Exemple #20
0
<h1><?php 
echo __('Feedback requests');
?>
</h1>
<?php 
echo $this->render('feedback/_authTabs');
?>

<?php 
if ($records->count() < 1) {
    echo '<p class="alert alert-warning">' . __('No requests is founded') . '</p>';
    return;
}
$items = [];
foreach ($records as $item) {
    $items[] = [['text' => $item->id], ['text' => Url::link(['feedback/read', $item->id, $item->hash], Text::cut($item->message, 0, 40)), 'html' => true], ['text' => (int) $item->closed === 1 ? '<span class="label label-danger">' . __('Closed') . '</span>' : '<span class="label label-success">' . __('Opened') . '</span>', 'html' => true, '!secure' => true], ['text' => Date::convertToDatetime($item->created_at, Date::FORMAT_TO_HOUR)], ['text' => Date::convertToDatetime($item->updated_at, Date::FORMAT_TO_HOUR)]];
}
?>

<?php 
echo \Ffcms\Core\Helper\HTML\Table::display(['table' => ['class' => 'table table-bordered'], 'thead' => ['titles' => [['text' => '#'], ['text' => __('Message')], ['text' => __('Status')], ['text' => __('Created')], ['text' => __('Updated')]]], 'tbody' => ['items' => $items]]);
?>


<div class="text-center">
    <?php 
echo $pagination->display(['class' => 'pagination pagination-centered']);
?>
</div>
Exemple #21
0
?>

<h1><?php 
echo __('Feedback list');
?>
</h1>
<hr />
<?php 
if ($records === null || $records->count() < 1) {
    echo '<p class="alert alert-warning">' . __('Feedback requests is empty now!') . '</p>';
    return;
}
$items = [];
foreach ($records as $item) {
    /** @var \Apps\ActiveRecord\FeedbackPost $item*/
    $items[] = [['text' => $item->id . ((int) $item->readed !== 1 ? ' <i class="fa fa-bell alert-info"></i>' : null), 'html' => true], ['text' => Url::link(['feedback/read', $item->id], Text::snippet($item->message, 40, false)), 'html' => true], ['text' => $item->getAnswers()->count()], ['text' => $item->email], ['text' => (int) $item->closed === 1 ? '<span class="label label-danger">' . __('Closed') . '</span>' : '<span class="label label-success">' . __('Opened') . '</span>', 'html' => true, '!secure' => true], ['text' => Date::convertToDatetime($item->updated_at, Date::FORMAT_TO_HOUR)], ['text' => Url::link(['feedback/read', $item->id], '<i class="fa fa-list fa-lg"></i> ') . Url::link(['feedback/delete', 'post', $item->id], '<i class="fa fa-trash-o fa-lg"></i>'), 'html' => true, 'property' => ['class' => 'text-center']]];
}
?>

<div class="table table-responsive">
<?php 
echo Table::display(['table' => ['class' => 'table table-bordered'], 'thead' => ['titles' => [['text' => '#'], ['text' => __('Text')], ['text' => __('Answers')], ['text' => __('Author')], ['text' => __('Status')], ['text' => __('Date')], ['text' => __('Actions')]]], 'tbody' => ['items' => $items]]);
?>
</div>

<p><i class="fa fa-bell alert-info"></i> = <?php 
echo __('New request or new answer in feedback topic');
?>
</p>

<div class="text-center">
Exemple #22
0
?>
</h1>
<hr />
<?php 
if ($records->count() < 1) {
    echo __('Content is not found yet');
    return;
}
$items = [];
foreach ($records as $record) {
    $moderate = (int) $record->display === 0;
    $title = $record->getLocaled('title');
    if ($moderate) {
        $title = Url::link(['content/update', $record->id], $title) . ' <i class="fa fa-pencil"></i>';
    }
    $items[] = [['text' => $record->id], ['type' => 'text', 'text' => $title, 'html' => true], ['text' => $moderate ? __('No') : __('Yes')], ['text' => Date::convertToDatetime($record->created_at, Date::FORMAT_TO_HOUR)], 'property' => ['class' => $moderate ? 'text-warning' : 'text-success']];
}
?>

<p><?php 
echo __('Remember you can edit content only on moderate stage!');
?>
</p>

<div class="table-responsive"><?php 
echo Table::display(['table' => ['class' => 'table table-bordered'], 'thead' => ['titles' => [['text' => '#'], ['text' => __('Title')], ['text' => __('Accepted')], ['text' => __('Date')]]], 'tbody' => ['items' => $items]]);
?>
</div>

<div class="text-center">
    <?php 
Exemple #23
0
 /**
  * Save changes in database
  */
 public function save()
 {
     $this->_content->title = $this->title;
     $this->_content->text = $this->text;
     $this->_content->path = $this->path;
     $this->_content->category_id = $this->categoryId;
     $this->_content->author_id = $this->authorId;
     $this->_content->display = $this->display;
     $this->_content->meta_title = $this->metaTitle;
     $this->_content->meta_keywords = $this->metaKeywords;
     $this->_content->meta_description = $this->metaDescription;
     $this->_content->source = $this->source;
     // check if rating is changed
     if ((int) $this->addRating !== 0) {
         $this->_content->rating += (int) $this->addRating;
     }
     // check if special comment hash is exist
     if ($this->_new || Str::length($this->_content->comment_hash) < 32) {
         $this->_content->comment_hash = $this->generateCommentHash();
     }
     // check if date is updated
     if (!Str::likeEmpty($this->createdAt) && !Str::startsWith('0000', Date::convertToDatetime($this->createdAt, Date::FORMAT_SQL_TIMESTAMP))) {
         $this->_content->created_at = Date::convertToDatetime($this->createdAt, Date::FORMAT_SQL_TIMESTAMP);
     }
     // save poster data
     $posterPath = '/upload/gallery/' . $this->galleryFreeId . '/orig/' . $this->poster;
     if (File::exist($posterPath)) {
         $this->_content->poster = $this->poster;
     }
     // get temporary gallery id
     $tmpGalleryId = $this->galleryFreeId;
     // save row
     $this->_content->save();
     // update tags data in special table (relation: content->content_tags = oneToMany)
     ContentTag::where('content_id', '=', $this->_content->id)->delete();
     $insertData = [];
     foreach ($this->metaKeywords as $lang => $keys) {
         // split keywords to tag array
         $tags = explode(',', $keys);
         foreach ($tags as $tag) {
             // cleanup tag from white spaces
             $tag = trim($tag);
             // prepare data to insert
             if (Str::length($tag) > 0) {
                 $insertData[] = ['content_id' => $this->_content->id, 'lang' => $lang, 'tag' => $tag];
             }
         }
     }
     // insert tags
     ContentTag::insert($insertData);
     // move files
     if ($tmpGalleryId !== $this->_content->id) {
         Directory::rename('/upload/gallery/' . $tmpGalleryId, $this->_content->id);
     }
 }
Exemple #24
0
            <img class="img-responsive img-rounded" alt="Avatar of <?php 
echo $referNickname;
?>
" src="<?php 
echo $referObject->getProfile()->getAvatarUrl('small');
?>
" />
        </div>
    </div>
    <div class="col-md-10">
        <h5 style="margin-top: 0;">
            <i class="fa fa-pencil"></i> <?php 
echo Url::link(['profile/show', $post->sender_id], $referNickname);
?>
            <small class="pull-right"><?php 
echo Date::convertToDatetime($post->updated_at, Date::FORMAT_TO_SECONDS);
?>
</small>
        </h5>
        <div class="wall-post-text">
            <?php 
echo \App::$Security->strip_tags($post->message);
?>
        </div>
    </div>
</div>

<?php 
$form = new Form($model, ['class' => 'form-horizontal', 'method' => 'post']);
echo $form->start();
echo $form->field('id', 'hidden');
Exemple #25
0
?>
</h1>
<hr />
<?php 
echo __('Are you sure to delete this comments or answers?');
?>

<?php 
$items = [];
foreach ($records as $item) {
    $message = Str::sub(\App::$Security->strip_tags($item->message), 0, 50);
    $author = Simplify::parseUserNick($item->user_id, $item->guest_name);
    if ((int) $item->user_id > 0) {
        $author = Url::link(['user/update', (int) $item->user_id], $author);
    }
    $items[] = [['text' => $item->id], ['text' => $message], ['text' => $author, 'html' => true], ['text' => Date::convertToDatetime($item->created_at, Date::FORMAT_TO_HOUR)]];
}
?>
<div class="table-responsive">
<?php 
echo Table::display(['table' => ['class' => 'table table-bordered'], 'thead' => ['titles' => [['text' => '#'], ['text' => __('Message')], ['text' => __('Author')], ['text' => __('Date')]]], 'tbody' => ['items' => $items]]);
?>
</div>


<?php 
$form = new Form($model, ['class' => 'form-horizontal', 'method' => 'post']);
echo $form->start();
?>

<?php 
Exemple #26
0
<?php

use Ffcms\Core\Helper\Date;
use Ffcms\Core\Helper\HTML\Table;
use Ffcms\Core\Helper\Url;
/** @var $this object */
/** @var $records Apps\ActiveRecord\UserLog */
$this->title = __('Logs');
$this->breadcrumbs = [Url::to('main/index') => __('Home'), Url::to('profile/show', \App::$User->identity()->getId()) => __('Profile'), __('Logs')];
?>

<?php 
echo $this->render('profile/_settingsTab');
?>

<h2><?php 
echo __('My logs');
?>
</h2>
<hr />
<?php 
if ($records === null || $records->count() < 1) {
    echo __('No logs is available');
    return;
}
$logs = [];
foreach ($records->get() as $log) {
    $logs[] = [['type' => 'text', 'text' => $log->id], ['type' => 'text', 'text' => $log->type], ['type' => 'text', 'text' => $log->message], ['type' => 'text', 'text' => Date::convertToDatetime($log->created_at, Date::FORMAT_TO_HOUR)]];
}
echo Table::display(['table' => ['class' => 'table table-striped'], 'thead' => ['titles' => [['text' => '#'], ['text' => __('Type')], ['text' => __('Message')], ['text' => __('Date')]]], 'tbody' => ['items' => $logs]]);
Exemple #27
0
use Ffcms\Core\Helper\Url;
/** @var $widget object */
/** @var $this object */
/** @var $model object */
$this->title = __('Turn on/off');
$this->breadcrumbs = [Url::to('main/index') => __('Main'), Url::to('widget/index') => __('Widgets'), __('Turn on/off')];
?>

<h1><?php 
echo __('Widget turn on/off');
?>
</h1>
<hr />

<?php 
echo Table::display(['table' => ['class' => 'table table-bordered'], 'thead' => ['titles' => [['text' => __('Param')], ['text' => __('Value')]]], 'tbody' => ['items' => [[['text' => __('Name')], ['text' => $widget->getLocaleName()]], [['text' => __('System name')], ['text' => $widget->sys_name]], [['text' => __('Last update')], ['text' => Date::convertToDatetime($widget->updated_at, DATE::FORMAT_TO_SECONDS)]], [['text' => __('Status')], ['text' => (int) $widget->disabled === 0 ? 'On' : 'Off'], 'property' => ['class' => (int) $widget->disabled === 0 ? 'alert-success' : 'alert-danger']]]]]);
?>

<?php 
$form = new Form($model, ['class' => 'form-horizontal', 'method' => 'post', 'action' => '', 'enctype' => 'multipart/form-data']);
?>

<?php 
echo $form->start();
?>

<div class="col-md-12">
    <?php 
echo $form->submitButton(__('Switch'), ['class' => 'btn btn-primary']);
?>
    <?php 
Exemple #28
0
                    <td><?php 
echo Date::convertToDatetime($user->created_at, Date::FORMAT_TO_DAY);
?>
</td>
                </tr>
                <?php 
if ($user->getProfile()->birthday !== null && !Str::startsWith('0000-', $user->getProfile()->birthday)) {
    ?>
                <tr>
                    <td><?php 
    echo __('Birthday');
    ?>
</td>
                    <td>
                        <?php 
    echo Url::link(['profile/index', 'born', Date::convertToDatetime($user->getProfile()->birthday, 'Y')], Date::convertToDatetime($user->getProfile()->birthday, Date::FORMAT_TO_DAY));
    ?>
                    </td>
                </tr>
                <?php 
}
?>
                <?php 
$sex = $user->getProfile()->sex;
?>
                <tr>
                    <td><?php 
echo __('Sex');
?>
</td>
                    <td>
Exemple #29
0
    foreach ($record->getAnswers()->get() as $answer) {
        ?>
        <div class="panel <?php 
        echo (int) $answer->is_admin === 1 ? 'panel-success' : 'panel-default';
        ?>
">
            <div class="panel-heading">
                <?php 
        echo __('From');
        ?>
: <?php 
        echo $answer->name . '(' . $answer->email . ')' . ((int) $answer->user_id > 0 ? Url::link(['user/update', $answer->user_id], '[id' . $answer->user_id . ']') : null);
        ?>
,
                <?php 
        echo Date::convertToDatetime($answer->created_at, Date::FORMAT_TO_HOUR);
        ?>
                <span class="pull-right">
                    <?php 
        echo Url::link(['feedback/update', 'answer', $answer->id], __('Edit'), ['class' => 'label label-primary']);
        ?>
                    <?php 
        echo Url::link(['feedback/delete', 'answer', $answer->id], __('Delete'), ['class' => 'label label-danger']);
        ?>
                </span>
            </div>
            <div class="panel-body">
                <?php 
        echo Str::replace("\n", "<br />", $answer->message);
        ?>
            </div>
Exemple #30
0
<?php 
if ($records === null || $records->count() < 1) {
    echo '<p class="alert alert-warning">' . __('Answers is not founded') . '</p>';
    return;
}
$items = [];
$moderateIsFound = false;
foreach ($records as $item) {
    $commentObject = $item->getCommentPost();
    $message = Text::cut(\App::$Security->strip_tags($item->message), 0, 75);
    $moderate = (bool) $item->moderate;
    if ($moderate) {
        $moderateIsFound = true;
    }
    $items[] = [1 => ['text' => $item->id], 2 => ['text' => ($moderate ? '<i class="fa fa-exclamation text-warning"></i> ' : null) . Url::link(['comments/read', $commentObject->id, null, ['#' => '#answer-' . $item->id]], $message), 'html' => true], 3 => ['text' => Simplify::parseUserLink((int) $item->user_id, $item->guest_name, 'user/update'), 'html' => true], 4 => ['text' => '<a href="' . App::$Alias->scriptUrl . $commentObject->pathway . '" target="_blank">' . Str::sub($commentObject->pathway, 0, 20) . '...</a>', 'html' => true], 5 => ['text' => Date::convertToDatetime($item->created_at, Date::FORMAT_TO_HOUR)], 6 => ['text' => Url::link(['comments/read', $commentObject->id], '<i class="fa fa-list fa-lg"></i>') . ' ' . Url::link(['comments/delete', 'answer', $item->id], '<i class="fa fa-trash-o fa-lg"></i>'), 'html' => true, 'property' => ['class' => 'text-center']], 'property' => ['class' => 'checkbox-row' . ($moderate !== false ? ' alert-warning' : null)]];
}
$moderateAccept = false;
if ($moderateIsFound) {
    $moderateAccept = ['type' => 'submit', 'class' => 'btn btn-warning', 'value' => __('Publish'), 'formaction' => Url::to('comments/publish', 'answer')];
}
?>

<div class="table-responsive">
<?php 
echo Table::display(['table' => ['class' => 'table table-bordered table-hover'], 'thead' => ['titles' => [['text' => '#'], ['text' => __('Answer')], ['text' => __('Author')], ['text' => __('Page')], ['text' => __('Date')], ['text' => __('Actions')]]], 'tbody' => ['items' => $items], 'selectableBox' => ['attachOrder' => 1, 'form' => ['method' => 'GET', 'class' => 'form-horizontal', 'action' => Url::to('comments/delete', 'answer')], 'selector' => ['type' => 'checkbox', 'name' => 'selected[]', 'class' => 'massSelectId'], 'buttons' => [['type' => 'submit', 'class' => 'btn btn-danger', 'value' => __('Delete selected'), 'formaction' => Url::to('comment/delete', 'answer')], $moderateAccept]]]);
?>
</div>

<div class="text-center">
    <?php