コード例 #1
0
 public function createPresenters()
 {
     parent::createPresenters();
     $image = new SimpleImageUpload('Image');
     self::$model = $this->raiseEvent('GetRestModel');
     $image->attachEventHandler('FileUploaded', function ($file, $location) {
         $path = "static/images/usrimgs/";
         if (!dir($path)) {
             mkdir($path, 0777, true);
         }
         if (GalleryAddPresenter::isFileImage($location)) {
             $id = self::$model->UniqueIdentifier;
             if (!$id) {
                 $id = CustomUser::findLast()->UniqueIdentifier++;
             }
             rename($location, $path . $id);
         }
     });
     $this->addPresenters($image, 'Username', 'Forename', 'Surname', 'Email', 'Gender', 'PhoneNumber', 'ShowDetails', new Password('PasswordPlace'));
     foreach ($this->presenters as $presenter) {
         if ($presenter instanceof TextBox || $presenter instanceof DropDown) {
             $presenter->addCssClassName('form-control');
             $presenter->addHtmlAttribute('autocomplete', 'off');
         }
     }
     $this->presenters['Save']->addCssClassName('btn-primary');
     $this->presenters['Save']->setButtonText('Saglabāt');
     $this->presenters['Cancel']->setButtonText('Atcelt');
 }
コード例 #2
0
    protected function printViewContent()
    {
        $html = new HtmlPageSettings();
        $html->PageTitle = "Galerijas";
        if (CustomUser::getLoggedInUser()->IsSuperuser) {
            $html->PageRightTitle = '<a href="/portal/gallery/change/" class="btn btn-default">Mainīt</a>';
        }
        $html->PageRightTitle .= '&nbsp;<a href="gallery/add/" class="btn btn-primary">Pievienot galeriju</a>';
        ?>
        <div class="__container">
            <div class="row" style="height: 150px;">
                <?php 
        $discussions = Gallery::find()->addSort('Order');
        foreach ($discussions as $discussion) {
            print '<div class="col-xs-6 col-md-2 center-align">';
            print new GalleryPresenter($discussion);
            print '</div>';
        }
        ?>
            </div>
            <div class="__clear-floats"></div>

        </div>
        <?php 
    }
コード例 #3
0
 public function createPresenters()
 {
     parent::createPresenters();
     $this->addPresenters($table = new Table(CustomUser::find(new Equals('Enabled', true)), 25, 'UserTable'), $delete = new Button('Dzēst', 'Dzēst', function ($a) {
         try {
             $user = new CustomUser($a);
             $user->Enabled = false;
             $user->save();
         } catch (RecordNotFoundException $ex) {
         }
     }), $edit = new Button('Mainīt', 'Mainīt', function ($a) {
         throw new ForceResponseException(new RedirectResponse('/users/' . $a . '/edit/'));
     }));
     $delete->addCssClassName('btn-danger');
     $delete->setConfirmMessage('Vai jūs tiešam gribat dzēst šo lietotāju?');
     $table->addTableCssClass(['table table-striped table-bordered']);
     $this->presenters['UserTable']->Columns = ['Lietotaja vārds' => 'Username', 'Vārds' => 'Forename', 'Uzvārds' => 'Surname', 'E - pasts' => 'Email', '' => new FixedWidthColumn($edit), ' ' => new FixedWidthColumn($delete)];
 }
コード例 #4
0
    protected function printViewContent()
    {
        if ($this->userID instanceof CustomUser) {
            $user = $this->userID;
        } else {
            $user = new CustomUser($this->userID);
        }
        ?>
        <div class="center-align" style="padding-top: 6px;">
            <img class="img-circle" src="<?php 
        echo $user->Image;
        ?>
" alt="Nevarēju atrast bildi" width="140" height="140">
            <h4><?php 
        echo $user->getFullName();
        ?>
</h4>
            <?php 
        if ($user->ShowDetails) {
            ?>
                    <p><a href="mailto:<?php 
            echo $user->Email;
            ?>
"><?php 
            echo $user->Email;
            ?>
</a></p>
                    <p><?php 
            echo $user->PhoneNumber;
            ?>
</p>
                    <?php 
        }
        ?>
        </div>
        <?php 
    }
コード例 #5
0
 protected function printViewContent()
 {
     $users = CustomUser::find(new Equals('Enabled', 1))->addSort('UserID', false);
     $html = new HtmlPageSettings();
     $html->PageTitle = "Visi portāla lietotāji";
     ?>
         <div class="__container">
             <div class="row">
                 <?php 
     foreach ($users as $user) {
         print '<div class="col-xs-4 col-md-2 center-align">';
         print new ProfileSummaryPresenter($user);
         print '</div>';
     }
     ?>
             </div>
         </div>
     <?php 
 }
コード例 #6
0
    protected function printViewContent()
    {
        parent::printViewContent();
        $discussions = Gallery::find()->addSort('Order')->setRange(0, 6);
        $users = CustomUser::find(new Equals('Enabled', 1))->addSort('UserID', false)->setRange(0, 6);
        $sql = MySql::executeStatement('SELECT Source FROM tblImage ORDER BY RAND() LIMIT 6');
        $images = [];
        while ($a = $sql->fetch(\PDO::FETCH_ASSOC)) {
            $images[] = $a['Source'];
        }
        ?>
        <div class="__container noPadding">
            <?php 
        echo new ImagePanorama($images);
        ?>
        </div>
        <div class="row">
            <div class="discussion-group col-md-6">
                <div class="__container min-height-500">
                    <div class="center-block clearfix relative">
                        <h1 style="text-align: center">
                            Top 6 Galerijas
                        </h1>
                        <a href="gallery/add/" class="btn btn-primary right-side-title">Pievienot galeriju</a>
                    </div>
                    <div class="row" style="height: 150px; text-align: center">
                        <?php 
        foreach ($discussions as $discussion) {
            print '<div class="col-md-4 center-align">';
            print new GalleryPresenter($discussion);
            print '</div>';
        }
        ?>
                    </div>
                    <div class="__clear-floats"></div>
                    <div class="__clear-floats"></div>
                </div>
            </div>
            <div class="col-md-6">
                <div class="__container noPadding min-height-500">
                    <div class="center-block clearfix relative">
                        <h1 style="text-align: center">
                            6 Jaunākie biedri portālā!
                        </h1>
                        <a href="/portal/users/" class="btn btn-primary right-side-title">Redzēt visus</a>
                    </div>
                    <div class="row">
                        <?php 
        foreach ($users as $user) {
            print '<div class="col-md-4 center-align">';
            print new ProfileSummaryPresenter($user);
            print '</div>';
        }
        ?>
                    </div>
                    <div class="__clear-floats"></div>
                </div>
            </div>
        </div>

        <?php 
    }
コード例 #7
0
    public static function getCommentsForCommentID($id)
    {
        if (is_int($id) || is_string($id)) {
            $comment = new Comment($id);
        } else {
            $comment = $id;
        }
        $builder = "";
        $user = new CustomUser($comment->PostedBy);
        $fullname = ucwords($user->getFullName());
        $subCommentBuilder = "";
        $comments = Comment::find(new Equals('InReplyTo', $comment->UniqueIdentifier));
        foreach ($comments as $c) {
            $subCommentBuilder .= self::getCommentsForCommentID($c->CommentID);
        }
        $com = nl2br($comment->Comment);
        $builder .= <<<HTML
                        <div class="comment-outer">
                            <div class="comment-background-underlay"></div>
                            <div class="comment-outer-image">
                                <img src="{$user->Image}">
                            </div>
                            <div class="comment-outer-text">
                                <div class="comment-outer-title">
                                    <span class="comment-inner-name">{$fullname}</span><span class="comment-inner-date">{$comment->PostedAt}</span>
                                </div>
                                <div class="delete">
                                    X
                                </div>
                                <div class="comment-inner-text">{$com}</div>
                                <a href="#" comId="{$comment->UniqueIdentifier}" class="comment-reply">Atbildēt</a>
                            </div>
                            <div class="__clear-floats"></div>
                            {$subCommentBuilder}
                         </div>
                         <div class="__clear-floats"></div>
HTML;
        return $builder;
    }