Example #1
0
 public function action_index()
 {
     foreach ($this->_group_actions as $action => $cfg) {
         if (!ACL::is_action_allowed($this->request->directory(), $this->request->controller(), $action)) {
             unset($this->_group_actions[$action]);
         }
     }
     if (isset($_POST['group_actions'])) {
         $action = NULL;
         foreach (arr::get($_POST, 'action', array()) as $name => $value) {
             $action = $name;
         }
         $handler = arr::path($this->_group_actions, $action . '.handler');
         if ($action && $handler && method_exists($this, $handler)) {
             if (arr::path($this->_group_actions, $action . '.one_item')) {
                 foreach ($_POST['ids'] as $id) {
                     $item = ORM::factory($this->_model, $id);
                     if ($item->loaded()) {
                         $this->{$handler}($item);
                     }
                 }
             } else {
                 $ids = array();
                 foreach ($_POST['ids'] as $id) {
                     if ($id) {
                         $ids[] = $id;
                     }
                 }
                 if (count($ids)) {
                     $this->{$handler}($ids);
                 }
             }
         }
         $this->back($this->get_index_route());
     }
     $this->set_view('crud/index');
     Navigation::instance()->actions()->add($this->get_create_route(), 'Добавить');
     $model = ORM::factory($this->_model);
     $this->template->filter_form = $this->get_filter_form($model);
     if ($this->template->filter_form) {
         $this->template->filter_form->set_method('GET');
         if (isset($_GET['filter_cancel'])) {
             $this->redirect('/' . Extasy_Url::url_to_route($this->get_index_route()));
         }
         if (isset($_GET['filter'])) {
             $this->template->filter_form->submit();
         }
     }
     $this->template->unSortableFields = $model->getUnSortableSortableFields();
     $grid = $this->before_fetch($model)->grid()->set_group_actions($this->_group_actions);
     $this->template->grid = $this->prepare_grid($grid);
 }
Example #2
0
						<input class="text-input medium-input" type="text" id="ff_first_name" name="first_name" value="<?php 
echo arr::get($user, 'first_name');
?>
" />
					</p>
					<p>
						<label for="ff_username">Username</label>
						<input class="text-input medium-input" type="text" id="ff_username" name="username" value="<?php 
echo arr::get($user, 'username');
?>
" />
					</p>
					<p>
						<label for="ff_role">Role</label>
						<?php 
echo form::select('role', $roles, arr::path($user, 'role.id'), array('class' => 'medium-input', 'id' => 'ff_role'));
?>
					</p>
				</fieldset>

				<fieldset class="column-right">
					<p>
						<label for="ff_last_name">Last Name</label>
						<input class="text-input medium-input" type="text" id="ff_last_name" name="last_name" value="<?php 
echo arr::get($user, 'last_name');
?>
" />
					</p>
					<p>
						<label for="ff_password">New Password</label>
						<input class="text-input medium-input" type="password" id="ff_password" name="password" value="<?php 
Example #3
0
        echo $errs;
    }
    echo '</label>';
}
?>
					</div>
					<div class="form-group">
						<label for="confirm-new-password">Confirm your new password</label>
						<input minlength="5" title="Must match above password" class="<?php 
echo $errors && arr::get($errors, 'password_confirm', false) ? 'error' : '';
?>
" type="password" placeholder="Re-enter your new password.." id="confirm-new-password" name="password_confirm">
<?php 
if ($errors && arr::path($errors, '_external.password_confirm', false)) {
    echo '<label for="confirm-new-password" class="error">';
    $errs = arr::path($errors, '_external.password_confirm');
    if (is_array($errs)) {
        echo '<ul>';
        foreach ($errs as $err) {
            echo '<li>' . $err . '</li>';
        }
        echo '</ul>';
    } else {
        echo $errs;
    }
    echo '</label>';
}
?>
					</div>
					
					<div class="form-group text-right">
Example #4
0
 /**
  * Gets a value from an array using a dot separated path.
  *
  *     // Get the value of $array['foo']['bar']
  *     $value = KMS::Session()->path($array, 'foo.bar');
  *
  * Using a wildcard "*" will search intermediate arrays and return an array.
  *
  *     // Get the values of "color" in theme
  *     $colors = KMS::Session()->path($array, 'theme.*.color');
  *
  *     // Using an array of keys
  *     $colors = KMS::Session()->path($array, array('theme', '*', 'color'));
  *
  * @param   mixed   key path string (delimiter separated) or array of keys
  * @param   mixed   default value if the path is not set
  * @return  type
  */
 public function path($path, $default = NULL)
 {
     return arr::path($this->_data, $path, $default);
 }
Example #5
0
?>
					</p>
					<div class="clear"></div>
					<p>
						<?php 
echo form::label('ff_password', 'Password');
?>
						<?php 
echo form::password('password', NULL, array('id' => 'ff_password', 'class' => 'text-input'));
?>
					</p>
					<div class="clear"></div>
					<!--
					<p id="remember-password">
						<?php 
echo form::checkbox('remember', 1, (bool) arr::path($ua, 'fields.remember', 1), array('id' => 'ff_remember'));
?>
						<?php 
echo form::label('ff_remember', 'Remember me');
?>
					</p>
					<div class="clear"></div>
					-->
					<p>
						<?php 
echo form::submit('login', 'Sign In', array('class' => 'button'));
?>
					</p>
				<?php 
echo form::close();
?>
Example #6
0
 /**
  *
  * Returns custom type data by tagname.
  *
  * @param  string       $tag      tagname
  * @param  mixed        $default  default value if not exists
  * @return string|array
  */
 public static function custom($tag = NULL, $default = NULL)
 {
     if (is_null($tag)) {
         // returns all custom data
         if (!isset(self::$_data[message::CUSTOM])) {
             return $default;
         }
         $result = self::$_data[message::CUSTOM];
         // dont forget to clear data!
         self::remove(message::CUSTOM);
         return $result;
     }
     if (!isset(self::$_data[message::CUSTOM])) {
         return $default;
     }
     // check for existing
     if (isset(self::$_data[message::CUSTOM][$tag])) {
         // get tagged value and delete it from data
         $result = self::$_data[message::CUSTOM][$tag];
         self::remove(message::CUSTOM, $tag);
         return $result;
     } else {
         // check if there are dots in tag - its an array key
         if (strpos($tag, '.') === FALSE) {
             return $default;
         }
         return arr::path(self::$_data[message::CUSTOM], $tag, $default);
     }
 }
Example #7
0
    echo arr::path($errors, '_external.password', '');
    echo '</span>';
}
?>
			</div>
			
			<div class="form-group<?php 
echo arr::path($errors, '_external.password_confirm', false) ? ' has-error' : '';
?>
">
				<label for="account-password-confirm">Confirm password:</label>
				<input type="password" placeholder="Confirm your new password" name="password_confirm" id="account-password-confirm" class="form-control" />
<?php 
if (arr::path($errors, '_external.password_confirm', false)) {
    echo '<span class="help-block">';
    echo arr::path($errors, '_external.password_confirm', '');
    echo '</span>';
}
?>
			</div>
			
			<button class="btn btn-primary">Save info</button>
			
		</form>
		
	</div>
	<div class="tab-pane" id="actions">
		<h4>Actions:</h4>
		<p>
			<a id="account-deleter" href="<?php 
echo user::url('delete');