private function getUsers($name)
 {
     try {
         $users = $this->model->getUsersWithName($name);
         $this->values->users = $users;
         $this->values->name = $name;
     } catch (NoResultException $e) {
         $this->request->error = Bundle::get('friends.users.not.found', $name);
     }
 }
Exemplo n.º 2
0
 /**
  * Create requested Form Object.
  * @author anza
  * @param string $form Name of Form Object to be created.
  * @throws FormNotFoundException When impossible to find class of Form Object.
  * @return New Form Object if its class exists.
  */
 public static function build($form)
 {
     try {
         $fo = $form . self::FO;
         if (class_exists($fo)) {
             return new $fo();
         }
     } catch (LogicException $e) {
         throw new FormNotFoundException(Bundle::get('form.validation.form.not.found', $fo));
     }
 }
Exemplo n.º 3
0
 private function prepareMainLinks()
 {
     $friendsLink = DOMFactory::getLink($this->url->getCustomActionURL('friends'), Bundle::get('link.header.friends.link'))->addClass('bold tahoma-13');
     $friendsFindLink = DOMFactory::getLink($this->url->getCustomActionURL('friends', 'find'), Bundle::get('link.header.friends.find.link'))->addClass('bold tahoma-13');
     $videoLink = DOMFactory::getLink($this->url->getCustomActionURL('video'), Bundle::get('link.header.video'))->addClass('bold tahoma-13');
     $addVideoLink = DOMFactory::getLink($this->url->getCustomActionURL('video', 'add'), Bundle::get('link.header.video.add'))->addClass('bold tahoma-13');
     $this->template->friendsLink = DOMFactory::getLi($friendsLink);
     $this->template->friendsFindLink = DOMFactory::getLi($friendsFindLink);
     $this->template->videoLink = DOMFactory::getLi($videoLink);
     $this->template->addVideoLink = DOMFactory::getLi($addVideoLink);
 }
 public function add(AbstractController $controller, $redirect)
 {
     try {
         $fo = FOFactory::build('comment');
         if (!$fo->isSent()) {
             $this->redirectToCaller($redirect);
         }
         $this->model->add($fo, $fo->getType(), $fo->getId());
         $this->redirectToCaller($redirect);
     } catch (FormValidationException $e) {
         $this->values->error = Bundle::get('form.validation.invalid.value', $e->getMessage());
         $controller->setAction($redirect);
     }
 }
 /**
  * @Invocable
  */
 protected function add()
 {
     try {
         $fo = FOFactory::build('newvideo');
         if (!$fo->isSent()) {
             return;
         }
         $this->model->add($fo);
         Navigator::redirectTo('video');
     } catch (FormValidationException $e) {
         $e->getTraceAsString();
         $this->request->error = Bundle::get('form.validation.invalid.value', $e->getMessage());
     } catch (VideoNotExistsException $e) {
         $e->getTraceAsString();
         $this->request->error = Bundle::get('form.validation.video.url.incorrect', $e->getMessage());
     }
 }
 /**
  * Validate form data and register new user.
  * @Invocable
  */
 protected function register()
 {
     try {
         $fo = FOFactory::build('register');
         if (!$fo->isSent()) {
             return;
         }
         $this->model->register($fo);
         $this->request->success = Bundle::get('form.validation.field.register.success');
     } catch (FormValidationException $e) {
         $e->getTraceAsString();
         $this->request->error = Bundle::get('form.validation.invalid.value', $e->getMessage());
     } catch (DuplicateException $e) {
         $e->getTraceAsString();
         $this->request->error = Bundle::get('form.validation.login.taken', $e->getField());
     }
 }
Exemplo n.º 7
0
<?php

use Admin\Libraries\ModelHelper;
use Admin\Libraries\Fields\Field;
use Admin\Libraries\Column;
use Admin\Libraries\Sort;
//View Composers
//admin index view
View::composer('administrator::index', function ($view) {
    //get a model instance that we'll use for constructing stuff
    $modelInstance = ModelHelper::getModel($view->modelName);
    $columns = Column::getColumns($modelInstance);
    $editFields = Field::getEditFields($modelInstance);
    $bundleConfig = Bundle::get('administrator');
    //add the view fields
    $view->modelTitle = Config::get('administrator::administrator.models.' . $view->modelName . '.title', $view->modelName);
    $view->modelSingle = Config::get('administrator::administrator.models.' . $view->modelName . '.single', $view->modelTitle);
    $view->columns = $columns['columns'];
    $view->includedColumns = $columns['includedColumns'];
    $view->primaryKey = $modelInstance::$key;
    $view->sort = Sort::get($modelInstance)->toArray();
    $view->rows = ModelHelper::getRows($modelInstance, $view->sort);
    $view->editFields = $editFields['arrayFields'];
    $view->dataModel = $editFields['dataModel'];
    $view->filters = ModelHelper::getFilters($modelInstance);
    $view->baseUrl = URL::to_route('admin_index');
    $view->bundleHandles = $bundleConfig['handles'];
    $view->expandWidth = ModelHelper::getExpandWidth($modelInstance);
    $view->modelInstance = $modelInstance;
    $view->model = isset($view->model) ? $view->model : false;
});
Exemplo n.º 8
0
<?php

// Flyswatter Routes
Route::controller(array('flyswatter::home', 'flyswatter::issue', 'flyswatter::seed', 'flyswatter::comment', 'flyswatter::project'));
View::share('flyswatter', '/' . Bundle::get('flyswatter')['handles']);
View::share('projects', \Flyswatter\Models\Project::all());
Exemplo n.º 9
0
 public function testRouteResolution()
 {
     Bundle::start('flyswatter');
     $this->assertEquals('flyswatter::home@index', Router::route('GET', Bundle::get('flyswatter')['handles'])->action['uses']);
 }
Exemplo n.º 10
0
 /**
  * New password is send to email of selected User.
  * @param User $user
  * @param string $password
  */
 private function sendPassword(User $user, $password)
 {
     $subject = Bundle::get('recover.mail.subject');
     $message = $password;
     Mailer::send($user->getEmail(), $subject, $message);
 }
Exemplo n.º 11
0
 /**
  * Sends email with activation link.
  * @param User $user
  * @author anza
  */
 private function sendActivationLink(User $user)
 {
     $subject = Bundle::get('register.mail.subject');
     $message = URL::getInstance()->getCustomActionURL('auth', 'activate') . SLASH . $user->getActivation();
     Mailer::send($user->getEmail(), $subject, $message);
 }
Exemplo n.º 12
0
                <th>{{ Lang::line('modules::lang.Name')->get(ADM_LANG) }}</th>
                <th><span>{{ Lang::line('modules::lang.Description')->get(ADM_LANG) }}</span></th>
                <th>{{ Lang::line('modules::lang.Version')->get(ADM_LANG) }}</th>
                <th>{{ Lang::line('modules::lang.Status')->get(ADM_LANG) }}</th>
                
            </tr>
        </thead>    
        <tbody>
            @if(isset($core_modules) and !empty($core_modules))
            @foreach ($core_modules as $module)
            <tr>
                @if($module->slug == 'admin')
                    <td class="collapse"><a href="{{ URL::base().'/'.ADM_URI }}">{{ $module->name }}</a></td>
                @else
                    <?php 
$bundle = Bundle::get($module->slug);
?>
                    <?php 
$handles = isset($bundle['handles']) ? 1 : 0;
?>
                    @if($module->installed and $module->enabled and $handles == 1)
                    <td class="collapse"><a href="{{ URL::base().'/'.ADM_URI.'/'.$module->slug }}">{{ $module->name }}</a></td>
                    @else
                    <td class="collapse">{{ $module->name }}</td>
                    @endif
                @endif

                <td>{{ Lang::line($module->slug.'::lang.'.$module->description)->get(ADM_LANG) }}</td>
                <td class="align-center">{{ $module->version }}</td>
                <td class="align-center">OK</td>
            </tr>
Exemplo n.º 13
0
			<div class="row-fluid">
				<div class="span3">
					<div class="well sidebar-nav">
						<ul class="nav nav-list">
							<li class="nav-header">Log Files</li>
							<?php 
if ($files) {
    ?>
								<?php 
    foreach ($files as $file) {
        ?>
									<?php 
        $file = str_replace('.log', '', $file);
        ?>
									<li><a href="<?php 
        echo URL::to(Bundle::get('logviewer.handles') . '?date=' . $file);
        ?>
"><?php 
        echo $file;
        ?>
</a></li>
								<?php 
    }
    ?>
							<?php 
}
?>
						</ul>
					</div><!--/.well -->
				</div><!--/span-->
				<div class="span9">
Exemplo n.º 14
0
    // add styles to layout
    Asset::container('header')->add('bootstrap_style', 'bundles/gotin/css/bootstrap.css');
    Asset::container('header')->add('bootstrap_res', 'bundles/gotin/css/bootstrap-responsive.css');
    Asset::container('header')->add('docs_style', 'bundles/gotin/css/gotin.css');
    Asset::container('header')->add('gotin_style', 'bundles/gotin/css/docs.css');
    // add scripts to layout
    Asset::container('header')->add('jquery', 'bundles/gotin/js/jquery.js');
    Asset::container('header')->add('bootstrap', 'bundles/gotin/js/bootstrap.min.js');
    if (Config::get('gotin::gotin.login_mode') == "ajax") {
        Asset::container('header')->add('gotin', 'bundles/gotin/js/gotin.js');
    }
});
/**
 * Filter admin access
 */
Route::filter('auth', function () {
    if (!Auth::gotin_check()) {
        Auth::logout();
        return Redirect::to_action('login');
    }
    // Admin role protected routes
    $admin_protected = array('users', 'roles');
    $gotin_route = Bundle::get('gotin')['handles'];
    foreach ($admin_protected as $ap) {
        $r = $gotin_route . "\\/" . $ap;
        $match = preg_match("/" . $r . "/", URI::current());
        if ($match && !Auth::is("Admin")) {
            return Redirect::to_action('gotin::dashboard');
        }
    }
});
 /**
  * Activate existing User.
  * @Invocable
  */
 public function activate()
 {
     try {
         $activeHash = $this->validateActiveHash();
         $this->model->activate($activeHash);
         $this->request->success = Bundle::get('form.validation.field.register.activated');
     } catch (NoResultException $e) {
         $e->getTraceAsString();
         Navigator::redirectTo($this);
     }
 }