コード例 #1
0
ファイル: setuptables.php プロジェクト: xenophy/code-x
 /**
  * This method gets ran when a valid method name is not used in the command.
  *
  * Usage (from command line):
  *
  * php oil r setuptables:index "arguments"
  *
  * @return string
  */
 public function index($args = NULL)
 {
     echo "\n===========================================";
     echo "\nRunning task [Setuptables:Index]";
     echo "\n-------------------------------------------\n\n";
     /***************************
     		 Put in TASK DETAILS HERE
     		 **************************/
     // 初期ユーザー定義
     $init_users = array(array('name' => 'codex', 'password' => '1234', 'group' => 6));
     // データベース接続
     \DBUtil::set_connection(null);
     // {{{ トランケート
     $truncates = array('', '_permissions', '_metadata', '_user_permissions', '_group_permissions', '_role_permissions');
     foreach ($truncates as $truncate) {
         \DBUtil::truncate_table('users' . $truncate);
     }
     // }}}
     // {{{ 初期ユーザー追加
     foreach ($init_users as $init_user) {
         // ユーザー名
         $key = $init_user['name'];
         // パスワード
         $password = $init_user['password'];
         // メールアドレス
         $email = $key . '@xenophy.com';
         // グループ
         $group = $init_user['group'];
         // 追加
         $user = \Auth\Model\Auth_User::forge()->find(\Auth::create_user($key, $password, $email, $group));
         // 保存
         $user->save();
     }
     // }}}
 }
コード例 #2
0
ファイル: text.php プロジェクト: sebaxplace/skilla-local
 public function action_edit($id = null)
 {
     $text = Model_Text::find($id, ['related' => ['user']]);
     if ($this->can_access_content($text)) {
         $val = Model_Text::validate('edit');
         if ($val->run()) {
             $text->schedule_an_appointpent = Input::post('schedule_an_appointpent');
             //$text->schedule = Input::post('schedule');
             $text->name_first = Input::post('name_first');
             $text->name_last = Input::post('name_last');
             $text->email = Input::post('email');
             $text->notes = Input::post('notes');
             $text->time = Input::post('time');
             $text->date = Input::post('date');
             $text->reserve = Input::post('reserve');
             $text->thanks = Input::post('thanks');
             $text->for_reserve = Input::post('for_reserve');
             $text->donde = Input::post('donde');
             $text->orarios = Input::post('orarios');
             $text->contactos = Input::post('contactos');
             $text->designers = Input::post('designers');
             $text->where = Input::post('where');
             $text->opening_times = Input::post('opening_times');
             $text->contacts = Input::post('contacts');
             //$text->control_code = Input::post('control_code');
             //$text->newsletter_disclaimer = Input::post('newsletter_disclaimer');
             //$text->discover_all_products = Input::post('discover_all_products');
             $text->address = Input::post('address');
             $text->postal_code = Input::post('postal_code');
             //$text->city = Input::post('city');
             //$text->country = Input::post('country');
             //$text->continent = Input::post('continent');
             $text->latitude = Input::post('latitude');
             $text->longitude = Input::post('longitude');
             $text->kitchen_tittle = Input::post('kitchen_tittle');
             $text->kitchen_description = Input::post('kitchen_description');
             $text->Living_tittle = Input::post('Living_tittle');
             $text->Living_description = Input::post('Living_description');
             $text->youth_room_tittle = Input::post('youth_room_tittle');
             $text->youth_room_description = Input::post('youth_room_description');
             $text->cucine = Input::post('cucine');
             $text->matrimoniali = Input::post('matrimoniali');
             $text->bambini = Input::post('bambini');
             $text->soggiorni = Input::post('soggiorni');
             $text->idea = Input::post('idea');
             $text->linkcucine = Input::post('linkcucine');
             $text->linkmatrimoniali = Input::post('linkmatrimoniali');
             $text->linkbambini = Input::post('linkbambini');
             $text->linksoggiorni = Input::post('linksoggiorni');
             $text->linkidea = Input::post('linkidea');
             $text->user_id = Input::post('user_id');
             $text->enabled = Input::post('enabled', false);
             $text->approved = Input::post('approved', false);
             if ($text->save()) {
                 Session::set_flash('success', e('Updated text #' . $id));
                 Response::redirect('admin/text');
             } else {
                 Session::set_flash('error', e('Could not update text #' . $id));
             }
         } else {
             if (Input::method() == 'POST') {
                 $text->schedule_an_appointpent = $val->validated('schedule_an_appointpent');
                 //$text->schedule = $val->validated('schedule');
                 $text->name_first = $val->validated('name_first');
                 $text->name_last = $val->validated('name_last');
                 $text->email = $val->validated('email');
                 $text->notes = $val->validated('notes');
                 $text->time = $val->validated('time');
                 $text->date = $val->validated('date');
                 $text->reserve = $val->validated('reserve');
                 $text->thanks = $val->validated('thanks');
                 $text->for_reserve = $val->validated('for_reserve');
                 $text->donde = $val->validated('donde');
                 $text->orarios = $val->validated('orarios');
                 $text->contactos = $val->validated('contactos');
                 $text->where = $val->validated('where');
                 $text->opening_times = $val->validated('opening_times');
                 $text->contacts = $val->validated('contacts');
                 $text->contacts = $val->validated('contacts');
                 //$text->control_code = $val->validated('control_code');
                 //$text->newsletter_disclaimer = $val->validated('newsletter_disclaimer');
                 //$text->discover_all_products = $val->validated('discover_all_products');
                 $text->address = Input::post('address');
                 $text->postal_code = Input::post('postal_code');
                 //$text->city = Input::post('city');
                 //$text->country = Input::post('country');
                 //$text->continent = Input::post('continent');
                 $text->latitude = $val->validated('latitude');
                 $text->longitude = $val->validated('longitude');
                 $text->kitchen_tittle = $val->validated('kitchen_tittle');
                 $text->kitchen_description = $val->validated('kitchen_description');
                 $text->Living_tittle = $val->validated('Living_tittle');
                 $text->Living_description = $val->validated('Living_description');
                 $text->youth_room_tittle = $val->validated('youth_room_tittle');
                 $text->youth_room_description = $val->validated('youth_room_description');
                 $text->cucine = $val->validated('cucine');
                 $text->matrimoniali = $val->validated('matrimoniali');
                 $text->bambini = $val->validated('bambini');
                 $text->soggiorni = $val->validated('soggiorni');
                 $text->idea = $val->validated('idea');
                 $text->linkcucine = $val->validated('linkcucine');
                 $text->linkmatrimoniali = $val->validated('linkmatrimoniali');
                 $text->linkbambini = $val->validated('linkbambini');
                 $text->linksoggiorni = $val->validated('linksoggiorni');
                 $text->linkidea = $val->validated('linkidea');
                 $text->user_id = $val->validated('user_id');
                 $text->enabled = $val->validated('enabled', false);
                 $text->approved = $val->validated('approved', false);
                 Session::set_flash('error', $val->error());
             }
             $this->template->set_global('text', $text, false);
         }
         $users = \Auth\Model\Auth_User::find('all', ['related' => ['group']]);
         $data = ['users' => []];
         foreach ($users as $user) {
             $data['users']['' . $user->id . ''] = $user->username;
         }
         $this->template->title = "Texts";
         $this->template->content = View::forge('admin/text/edit', $data);
     } else {
         Session::set_flash('error', e('Could not edit text #' . $id));
         Response::redirect('admin/text');
     }
 }
コード例 #3
0
ファイル: dashboard.php プロジェクト: AfterCursor/timetracker
}
?>
        </ol>
    </div>

    <div class="col-md-3">
        <h3>System Users</h3>

        <p><?php 
echo \Fuel\Core\Html::anchor('admin/users/create', 'New System User', array('class' => 'btn btn-success btn-xs'));
?>
</p>

        <ol>
            <?php 
foreach (\Auth\Model\Auth_User::find('all', array('where' => array(array('id', '>', 0)))) as $user) {
    ?>
                <li>
                    <?php 
    echo \Fuel\Core\Html::anchor("admin/users/edit/{$user->id}", $user->fullname);
    ?>
                    <?php 
    echo \Auth\Auth::get('id') == $user->id ? '<span class="glyphicon glyphicon-user"></span>' : '';
    ?>
                </li>
            <?php 
}
?>
        </ol>
    </div>
</div>