Example #1
0
 public function create_complaint()
 {
     $validator = Validator::make(array(varlang('numele-prenume') => Input::get('name'), varlang('email') => Input::get('email'), varlang('subiect-1') => Input::get('subject'), varlang('cod-de-verificare') => \SimpleCapcha::valid('complaint', Input::get('capcha')) ? 1 : null), array(varlang('numele-prenume') => 'required', varlang('email') => 'email|required', varlang('subiect-1') => 'required', varlang('cod-de-verificare') => 'required'));
     $return = array('message' => '', 'error' => 0);
     if ($validator->fails()) {
         $return['message'] = implode(' ', $validator->messages()->all('<p>:message</p>'));
         $return['error'] = 1;
     } else {
         $complaint = new SComplaintsModel();
         $complaint->post_id = Input::get('post_id');
         $complaint->username = Input::get('name');
         $complaint->email = Input::get('email');
         $complaint->address = Input::get('address');
         $complaint->title = Input::get('subject');
         $complaint->text = Input::get('message');
         $complaint->is_private = Input::get('private');
         $complaint->save();
         Template::viewModule($this->module_name, function () use($complaint) {
             $sendToUsers = \User::withRole('user-getemails');
             $data['complaint'] = $complaint;
             foreach ($sendToUsers as $user) {
                 $data['user'] = $user;
                 \Mail::send('views.complaint_email', $data, function ($message) use($user) {
                     $message->from("noreply@{$_SERVER['SERVER_NAME']}", 'WebLPA');
                     $message->subject("New message");
                     $message->to($user->email);
                 });
             }
         });
     }
     return $return;
 }
Example #2
0
 public function cv_form_submit()
 {
     $validator = Validator::make(array('post_id' => Input::get('post_id'), varlang('name-last-name') => Input::get('name'), varlang('cv') => Input::file('upload')), array('post_id' => 'required', varlang('name-last-name') => 'required', varlang('cv') => 'required'));
     $return = array('message' => '', 'error' => 0);
     if ($validator->fails()) {
         $return['message'] = implode('<br>', $validator->messages()->all(':message'));
         $return['error'] = 1;
     } else {
         $post_id = Input::get('post_id');
         $name = Input::get('name');
         $filename = 'cv_' . $post_id . '_' . date("Y-m-d") . '_' . uniqid() . '.pdf';
         $filepath = "/upload/cv/";
         $audience = new JobRequestModel();
         $audience->post_id = $post_id;
         $audience->name = $name;
         $audience->save();
         $attachFile = false;
         if (Input::file('upload')->isValid()) {
             $audience->cv_path = $filepath . $filename;
             $audience->save();
             $attachFile = $filepath . $filename;
             Input::file('upload')->move($_SERVER['DOCUMENT_ROOT'] . $filepath, $filename);
         } else {
             $return['message'] = 'Invalid file';
             $return['error'] = 1;
         }
         Template::viewModule($this->module_name, function () use($name, $attachFile) {
             $data['name'] = $name;
             \EmailModel::sendToAdmins("New job reqest", 'views.email-request', $data, $attachFile);
         });
     }
     return $return;
 }
Example #3
0
 public function page_bottom_gallery($page)
 {
     $gallery = GalleryPost::where('post_id', $page['id'])->get()->first();
     if ($gallery) {
         $data = array('list' => Files::file_list('gallery', $gallery->gallery_id));
         echo Template::moduleView($this->module_name, 'views.page_gallery', $data);
     }
 }
Example #4
0
 public function loadHome($page)
 {
     $page_properies = \PostProperty::getPostProperties($page->id);
     if (in_array('show_file_page', $page_properies)) {
         $data = array();
         $data['acte'] = ActeLocaleModel::join(Files::getTableName(), Files::getField('module_id'), '=', ActeLocaleModel::getField('id'))->where(Files::getField('module_name'), 'actelocale')->select(ActeLocaleModel::getField("*"), Files::getField('path'))->orderBy('date_upload', 'desc')->take(2)->get();
         echo Template::moduleView($this->module_name, 'views.sidebar-acte', $data)->render();
     }
 }
Example #5
0
 /**
  * Initialize module
  * This function is called on bootstrap
  */
 public static function __init()
 {
     $template = Template::findTemplate();
     Template::setTemplate($template);
     $startup_file = $_SERVER['DOCUMENT_ROOT'] . Template::path('startup.php', 'frontend', \SettingsModel::one('template_frontend'));
     if (file_exists($startup_file)) {
         include $startup_file;
     }
 }
Example #6
0
 public function editact($id)
 {
     \User::onlyHas('actelocale-view');
     $data['act'] = ActeLocaleModel::find($id);
     if ($data['act']) {
         $this->layout->content = Template::moduleView($this->module_name, 'views.form', $data);
         return $this->layout;
     } else {
         throw new Exception("Record not found");
     }
 }
Example #7
0
 public function unsubscribe($code)
 {
     \NewsletterModel::where('hash', $code)->update(array('enabled' => 0));
     return (new \PageController())->createPageFrom(function () {
         Template::setPageTitle('Newsletter');
         Template::clearBreadCrumbs();
         Template::addBreadCrumb('/', 'Home');
         Template::addBreadCrumb('#', 'Newsletter');
         return View::make(Newsletter::$view_unsub);
     });
 }
Example #8
0
 public function soclist()
 {
     \User::onlyHas('socialc-view');
     $pages = \Post::join(\PostLang::getTableName(), \PostLang::getField('post_id'), '=', \Post::getField('id'))->where(\PostLang::getField('lang_id'), \WebAPL\Language::getId())->where(\Post::getField('taxonomy_id'), 1)->orderBy(\PostLang::getField('title'), 'desc')->get();
     $page_list = array();
     $page_json = array();
     foreach ($pages as $page) {
         $page_list[] = "{$page->post_id}:{$page->title}";
         $page_json[$page->post_id] = $page->title;
     }
     $data['pagesString'] = implode(';', $page_list);
     $data['pagesJson'] = json_encode($page_json);
     $this->layout->content = Template::moduleView($this->module_name, 'views.list', $data);
     return $this->layout;
 }
Example #9
0
 public function __construct()
 {
     parent::__construct();
     $this->loadClass(array('PersonModel', 'PersonLangModel', 'PersonAudienceModel'));
     Template::registerViewMethod('page', 'group_with_persons', '', array($this, 'group_list'), true);
     Template::registerViewMethod('page', 'persons_with_photo', 'Persoane cu foto', array($this, 'photo_persons'), true);
     Template::registerViewMethod('page', 'persons_big', 'Persoane cu foto (viceprimari)', array($this, 'vicemayor'), true);
     Template::registerViewMethod('page', 'persons_mayor', 'Persoana cu foto (primar)', array($this, 'mayor'), true);
     Template::registerViewMethod('page', 'persons_secretar', 'Persoana cu foto (secretar)', array($this, 'secretar'), true);
     Template::registerViewMethod('page', 'city_councilors', 'Consilieri locali', array($this, 'councilors'), true);
     Shortcodes::register('person_subscribe', array($this, 'subscribe'));
     Route::post('person/subscribe_to_audience', array($this, 'subscribe_to_audience'));
     View::addNamespace('person', app_path('/modules/person/views'));
     $online_persons = \PersonModel::where('for_audience', 1)->get();
     $online_persons_arr = [];
     foreach ($online_persons as $person) {
         $online_persons_arr[] = $person->id;
     }
     View::share('online_persons', $online_persons_arr);
 }
Example #10
0
        </form>

    </div>

    <div class="tab-pane" id="apparence">


        <form action="<?php 
echo url('settings/save');
?>
" method="post" class="ajax-auto-submit">

            <table class="table table-bordered table-hover">

                <?php 
$colorSchemes = \WebAPL\Template::getColorSchemes();
?>
                <?php 
if ($colorSchemes) {
    ?>
                    <tr>
                        <th><?php 
    echo varlang('template-color-schema');
    ?>
</th>
                        <td>
                            <select class='form-control' name="set[templateSchema]">
                                <option name=''>---</option>
                                <?php 
    foreach ($colorSchemes as $schemaKey => $schema) {
        ?>
Example #11
0
 public function requests_list()
 {
     \User::onlyHas('jobrequest-view');
     $this->layout->content = Template::moduleView($this->module_name, 'views.list');
     return $this->layout;
 }
Example #12
0
 public function sendarticle()
 {
     $post_id = Input::get('id');
     $post = \PostLang::where('post_id', $post_id)->first();
     if ($post) {
         $data['post'] = $post;
         $data['post_url'] = url("/../" . \WebAPL\Language::ext() . "/topost/" . $post_id);
         Template::viewModule($this->module_name, function () use($data, $post) {
             $newsletterUsers = \NewsletterModel::where('enabled', 1)->get();
             foreach ($newsletterUsers as $user) {
                 if (filter_var($user->email, FILTER_VALIDATE_EMAIL)) {
                     $data['user'] = $user;
                     $data['unsubscribe_link'] = url("/../newsletter/unsubscribe/{$user->hash}");
                     Mail::send('views.emails.post', $data, function ($message) use($post, $user) {
                         $message->from("noreply@{$_SERVER['SERVER_NAME']}", 'WebLPA');
                         $message->subject($post->title . " :: NEWSLETTER");
                         $message->to($user->email);
                     });
                 }
             }
         });
     }
 }
Example #13
0
 /**
  * Action for left menu
  */
 public function left_menu_item()
 {
     if (User::has('poll-view')) {
         echo Template::moduleView($this->module_name, 'views.poll-menu');
     }
 }
Example #14
0
 public function page_group_attachment($post)
 {
     if ($post->view_mod == $this->page_view_mod && \User::has('calendar-view')) {
         $wdata = array('post' => $post->toArray(), 'calendar_groups' => \CalendarGroup::orderBy('name', 'asc')->get(), 'selected_groups' => array());
         $selected_groups = \CalendarPostModel::where('post_id', $post->id)->get();
         foreach ($selected_groups as $item) {
             $wdata['selected_groups'][] = $item->calendar_group_id;
         }
         echo Template::moduleView($this->module_name, 'views.attachment-calendar-page', $wdata);
     }
 }
Example #15
0
                    <?php 
}
?>
                </table>
            </td>
        </tr>

        <tr>
            <th><?php 
echo varlang('template-b');
?>
</th>
            <td>
                <table class="table">
                    <?php 
foreach (\WebAPL\Template::getTemplates('backend') as $template) {
    ?>
                        <tr>
                            <td class="col-lg-1"><input class="make-switch" id="tpl<?php 
    echo $template;
    ?>
" type="radio" name="set[template_backend]" value='<?php 
    echo $template;
    ?>
' <?php 
    echo isset($setts['template_backend']) && $setts['template_backend'] == $template ? 'checked' : '';
    ?>
></td>
                            <td><label for="tpl<?php 
    echo $template;
    ?>
Example #16
0
 /**
  * Find the given view in the list of paths.
  *
  * @param  string  $name
  * @param  array   $paths
  * @return string
  *
  * @throws \InvalidArgumentException
  */
 protected function findInPaths($name, $paths)
 {
     $paths = \WebAPL\Template::preparePaths($paths);
     foreach ($paths as $path) {
         foreach ($this->getPossibleViewFiles($name) as $file) {
             if ($this->files->exists($viewPath = $path . '/' . $file)) {
                 return $viewPath;
             }
         }
     }
     throw new \InvalidArgumentException("View [{$name}] not found.");
 }
Example #17
0
 public function pollShortcode($params)
 {
     $wdata['poll'] = PollModel::getWithVotes($params['id']);
     if (!$wdata['poll']) {
         throw new Exception("Poll not found #{$params['id']}");
     }
     if (PollModel::ivoted($params['id'])) {
         $wdata['total_votes'] = \PollVotesModel::where('poll_id', $wdata['poll']->id)->count();
         return Template::moduleView($this->module_name, 'views.pollResults', $wdata);
     } else {
         return Template::moduleView($this->module_name, 'views.pollItem', $wdata);
     }
 }
Example #18
0
            English here: <http://www.gnu.org/licenses/>.

            For more details about CMS WebAPL 1.0 please contact Enterprise Business
            Solutions SRL, Republic of Moldova, MD 2001, Ion Inculet 33 Street or send an
            email to office@ebs.md 
        -->
        
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title><?php 
echo WebAPL\Template::getPageTitle(isset($page) ? $page : null);
?>
</title>

        <?php 
foreach (\WebAPL\Template::getMetas() as $metaName => $metaContent) {
    ?>
            <meta name="<?php 
    echo $metaName;
    ?>
" content="<?php 
    echo $metaContent;
    ?>
" >
        <?php 
}
?>

        <meta name="viewport" content="width=device-width, initial-scale=1">
        <!-- Place favicon.ico and apple-touch-icon.png in the root directory -->
Example #19
0
 public function email_notifications()
 {
     if (\WebAPL\Modules::checkInstance('person')) {
         $events = \CalendarModel::join(CalendarLangModel::getTableName(), \CalendarModel::getField('id'), '=', CalendarLangModel::getField('calendar_item_id'))->join(\CalendarGroup::getTableName(), \CalendarGroup::getField('id'), '=', \CalendarModel::getField('calendar_group_id'))->join(\CalendarPostModel::getTableName(), \CalendarPostModel::getField('calendar_group_id'), '=', \CalendarGroup::getField('id'))->where(CalendarLangModel::getField('lang_id'), \WebAPL\Language::getId())->where(\CalendarModel::getField('enabled'), 1)->where(\CalendarModel::getField('person_id'), '<>', 0)->select(CalendarLangModel::getField("*"), \CalendarModel::getField('event_date'), \CalendarModel::getField('repeat_frequency'), \CalendarModel::getField('repeat_to_date'), \CalendarModel::getField('person_id'), \CalendarModel::getField('post_id'), \CalendarModel::getField('period'))->orderBy(\CalendarModel::getField('event_date'), 'asc')->where(function ($query) {
             $query->where(function ($query) {
                 $query->where(DB::raw("DATE(" . CalendarModel::getField('event_date') . ")"), '=', DB::raw('DATE(CURRENT_TIMESTAMP)'));
             })->orWhere(function ($query) {
                 $query->where(\CalendarModel::getField('event_date'), '<=', DB::raw('CURRENT_TIMESTAMP'))->where(\CalendarModel::getField('repeat_to_date'), '>=', DB::raw('CURRENT_TIMESTAMP'))->where(\CalendarModel::getField('repeat_frequency'), '<>', 'none');
             });
         })->get();
         $event_list = \CalendarModel::generateEvents($events, false);
         $today_events = [];
         foreach ($event_list as $event) {
             if (date("Y-m-d", strtotime($event['event_date'])) === date("Y-m-d") && strtotime($event['event_date']) >= time()) {
                 echo " sendone ";
                 $today_events[] = $event;
                 $this->loadClass(['PersonModel'], 'person');
                 $person = \PersonModel::getPerson($event['person_id']);
                 if (isset($person->email) && $person->email) {
                     Template::viewModule($this->module_name, function () use($person, $event) {
                         \EmailModel::sendToAddress($person->email, "Do you have an event today", 'views.calendarEmail', ['person' => $person, 'event' => $event]);
                     });
                 }
             }
         }
     }
 }
Example #20
0
 public function view()
 {
     $this->layout->content = Template::moduleView($this->module_name, 'views.partners');
     return $this->layout;
 }
Example #21
0
 public function sendmail()
 {
     $id = \Input::get('id');
     $html = \Input::get('messages');
     $person = \PersonModel::find($id);
     if ($person) {
         $data['html'] = $html;
         Template::viewModule($this->module_name, function () use($data, $person) {
             \Mail::send('views.email-mess', $data, function ($message) use($person) {
                 $message->from("noreply@{$_SERVER['SERVER_NAME']}", 'WebLPA');
                 $message->subject("Discutie on-line din " . date("Y-m-d H:i"));
                 $message->to($person->email);
             });
         });
     }
 }
Example #22
0
 public function page_group_attachment($post)
 {
     if (in_array($post->view_mod, array('persons_list', 'city_councilors', 'persons_big', 'persons_secretar', 'persons_mayor', 'group_with_persons', 'persons_with_photo'))) {
         $wdata = array('post' => $post->toArray(), 'person_groups' => PersonGroup::join(PersonGroupLang::getTableName(), PersonGroupLang::getField("group_id"), '=', PersonGroup::getField('id'))->select(PersonGroup::getField("id"), PersonGroupLang::getField("name"))->where(PersonGroupLang::getField("lang_id"), \WebAPL\Language::getId())->orderBy(\PersonGroupLang::getField('name'), 'asc')->get()->toArray(), 'selected_groups' => array());
         $selected_groups = PersonGroupPostModel::where('post_id', $post->id)->get();
         foreach ($selected_groups as $item) {
             $wdata['selected_groups'][] = $item->group_id;
         }
         echo Template::moduleView($this->module_name, 'views.attachment-group-page', $wdata);
     }
 }
Example #23
0
 /**
  * Get html for current schema
  */
 public static function pullCurrentSchema()
 {
     $currentSchema = \WebAPL\Template::getCurrentSchema();
     if (isset($currentSchema['css']) && $currentSchema['css']) {
         echo '<link rel="stylesheet" href="' . $currentSchema['css'] . '">';
     }
 }
Example #24
0
 /**
  * Generate an template path for the template.
  *
  * @param  string  $path
  * @param  bool    $secure
  * @return string
  */
 function res($path)
 {
     return \WebAPL\Template::path($path);
 }
Example #25
0
 public function buttonlist()
 {
     $data = array('online' => Firechat::online());
     echo Template::moduleView($this->module_name, 'views.chat-list-button', $data);
 }