예제 #1
0
 public function testClear()
 {
     DinklyFlash::set('clear_test_key_1', '1');
     DinklyFlash::set('clear_test_key_hello', 'world');
     $this->assertTrue(DinklyFlash::exists('clear_test_key_1'));
     $this->assertTrue(DinklyFlash::exists('clear_test_key_hello'));
     DinklyFlash::clear();
     $this->assertFalse(DinklyFlash::exists('clear_test_key_1'));
     $this->assertFalse(DinklyFlash::exists('clear_test_key_hello'));
 }
예제 #2
0
 /**
  * Loads default admin login and runs authentication
  * 
  * @return bool: always returns false on successful construction of default admin module
  * 
  */
 public function loadDefault()
 {
     if (isset($_POST['username']) && isset($_POST['password'])) {
         if (!DinklyUser::authenticate($_POST['username'], $_POST['password'])) {
             DinklyFlash::set('invalid_login', 'Invalid login');
         } else {
             $this->loadModule('admin', 'home', 'default', true);
         }
     }
     return true;
 }
예제 #3
0
    ?>
    <div class="alert alert-success">
    <?php 
    echo DinklyFlash::get('good_user_message');
    ?>
    <button type="button" class="close message-close" aria-hidden="true">&times;</button>
  </div>
  <?php 
}
?>
  <?php 
if (DinklyFlash::exists('error')) {
    ?>
  <div class="alert alert-danger">
  <?php 
    echo DinklyFlash::get('error');
    ?>
  <button type="button" class="close message-close" aria-hidden="true">&times;</button>
  </div>
  <?php 
}
?>

  <div>
    <h2>
        Dashboard
    </h2>
    <p>Hello <?php 
echo ucfirst(strtolower($logged_user->getFirstName()));
?>
!</p>
예제 #4
0
<?php

if (DinklyFlash::exists('warning_user_message')) {
    ?>
<div class="alert alert-warning">
  <?php 
    echo DinklyFlash::get('warning_user_message');
    ?>
  <button type="button" class="close message-close" aria-hidden="true">&times;</button>
</div>
<?php 
}
?>

<h3>Users <button type="button" class="btn btn-primary btn-create-user pull-right">Create User</button></h3>
<hr>

<?php 
if ($users != array()) {
    ?>
<table cellpadding="0" cellspacing="0" border="0"  class="table table-striped table-bordered dinkly-datatable" id="user-list">
  <thead>
    <tr>
      <th>Username</th>
      <th>Created</th>
      <th>Last Login</th>
      <th>Login Count</th>
      <th class="no-sort">Action</th>
    </tr>
  </thead>
  <tbody>
예제 #5
0
    ?>
  </div>
<?php 
}
?>
<div class="row">
  <div class="col-md-6 col-md-offset-3 admin-login" align="center">
    <div class="panel panel-primary" align="center" style="width: 80%;">
      <div class="panel-heading">Administrator Access</div>
      <div class="panel-body">
        <?php 
if (DinklyFlash::exists('invalid_login')) {
    ?>
        <div class="alert alert-danger">
          <?php 
    echo DinklyFlash::get('invalid_login');
    ?>
          <button type="button" class="close message-close" aria-hidden="true">&times;</button>
        </div>
        <?php 
}
?>
        <form id="sign-in-form" action="/admin/login/" class="form-horizontal" role="form" method="post">
          <div class="form-group">
            <label for="inputEmail3" class="col-sm-3 control-label">Email</label>
            <div class="col-sm-8">
              <input type="email" class="form-control" id="inputEmail3" placeholder="Email" name="username">
            </div>
          </div>
          <div class="form-group">
            <label for="inputPassword3" class="col-sm-3 control-label">Password</label>
예제 #6
0
 public function loadEdit($parameters)
 {
     $this->group = new DinklyGroup();
     if (isset($parameters['id'])) {
         $this->group->init($parameters['id']);
         if (isset($_POST['name'])) {
             $this->validateGroupPost($_POST);
             //If we have no errors, save the group and redirect to detail
             if ($this->errors == array()) {
                 $this->group->save();
                 DinklyFlash::set('good_group_message', 'Group successfully updated');
                 return $this->loadModule('admin', 'group', 'detail', true, true, array('id' => $this->group->getId()));
             }
         }
         return true;
     }
     return false;
 }
예제 #7
0
					<div class="alert alert-danger">
						<?php 
    echo DinklyFlash::get('request_error');
    ?>
						<button type="button" class="close message-close" aria-hidden="true">&times;</button>
					</div>
				<?php 
}
?>

				<?php 
if (DinklyFlash::exists('request_success')) {
    ?>
					<div class="alert alert-success">
						<?php 
    echo DinklyFlash::get('request_success');
    ?>
					</div>
				<?php 
}
?>
			</div>
		</div>

		<form class="form-inline" action="" method="post" style="padding-top: 50px;">
			<div class="form-group">
				<input id="email" name="email" type="text" class="form-control" placeholder="Enter Email Address">
			</div>
			<button type="submit" class="btn btn-primary">Reset Password</button>
		</form>
	</div>
예제 #8
0
<ol class="breadcrumb">
  <li><a href="/admin/user/">Users</a></li>
  <li class="active">User Detail</li>
</ol>

<?php 
if (DinklyFlash::exists('good_user_message')) {
    ?>
<div class="alert alert-success">
  <?php 
    echo DinklyFlash::get('good_user_message');
    ?>
  <button type="button" class="close message-close" aria-hidden="true">&times;</button>
</div>
<?php 
}
?>

<h3>User Detail <button type="button" data-toggle="modal" data-target="#delete-user-modal" class="pull-right btn btn-link">Delete User</button></h3>
<hr>
<div class="row">
	<div class="col-md-5">
		<form class="form-horizontal" role="form" action="" method="post" id="user-detail-form">	  
			<legend>User Info <button style="" type="button" class="btn btn-xs btn-link btn-edit-user">Edit</button></legend>
			<div class="form-group">
				<label class="col-sm-3 control-label" for="created">Created</label>
				<div class="col-md-7">
					<input value="<?php 
echo $user->getCreatedAt($date_format);
?>
" type="text" disabled="disabled" class="form-control" id="created" name="created">
 /**
  * Load default view
  *
  * @return bool: always returns true on successful construction of view
  *
  */
 public function loadDefault()
 {
     $this->user = $this->logged_user;
     //Handle save
     if (isset($_POST['user-id'])) {
         $this->user->init($_POST['user-id']);
         //Make sure the submitted user matches the one logged in
         if ($_POST['user-id'] == DinklyUser::getLoggedId()) {
             $this->validateUserPost($_POST);
             if ($_POST['date-format'] == 'MM/DD/YY') {
                 $this->user->setDateFormat('m/d/y');
             } else {
                 if ($_POST['date-format'] == 'DD/MM/YY') {
                     $this->user->setDateFormat('d/m/y');
                 }
             }
             if ($_POST['time-format'] == '12') {
                 $this->user->setTimeFormat('g:i a');
             } else {
                 if ($_POST['time-format'] == '24') {
                     $this->user->setTimeFormat('H:i');
                 }
             }
             //If we have no errors, save the user
             if ($this->errors == array()) {
                 $this->user->save();
                 $this->logged_user = $this->user;
                 DinklyFlash::set('good_user_message', 'Profile Updated');
             }
         }
     }
     //Timezone dropdown (http://stackoverflow.com/a/7022536/53079)
     $utc = new DateTimeZone('UTC');
     $dt = new DateTime('now', $utc);
     $this->select_options = null;
     $timezone_identifiers = DateTimeZone::listIdentifiers(DateTimeZone::PER_COUNTRY, 'US');
     foreach ($timezone_identifiers as $tz) {
         $current_tz = new DateTimeZone($tz);
         $offset = $current_tz->getOffset($dt);
         $transition = $current_tz->getTransitions($dt->getTimestamp(), $dt->getTimestamp());
         $abbr = $transition[0]['abbr'];
         $selected = null;
         if ($this->user->getTimeZone() == $tz) {
             $selected = 'selected="selected"';
         }
         $this->select_options .= '<option ' . $selected . ' value="' . $tz . '">' . str_replace('_', ' ', $tz) . ' [' . $abbr . ' ' . DinklyUser::formatOffset($offset) . ']</option>';
     }
     return true;
 }
예제 #10
0
<ol class="breadcrumb">
  <li><a href="/admin/group/">Groups</a></li>
  <li class="active">Group Detail</li>
</ol>

<?php 
if (DinklyFlash::exists('good_group_message')) {
    ?>
<div class="alert alert-success">
  <?php 
    echo DinklyFlash::get('good_group_message');
    ?>
  <button type="button" class="close message-close" aria-hidden="true">&times;</button>
</div>
<?php 
}
?>

<h3>Group Detail <button type="button" data-toggle="modal" data-target="#delete-group-modal" class="pull-right btn btn-link">Delete Group</button></h3>
<hr>
<div class="row">
	<div class="col-md-7">
		<form class="form-horizontal" role="form" action="" method="post" id="user-detail-form">	  
			<legend>Group Info <button style="" type="button" class="btn btn-xs btn-link btn-edit-group">Edit</button></legend>
			<div class="form-group">
				<label class="col-sm-3 control-label" for="name">Name</label>
				<div class="col-md-5">
					<input value="<?php 
echo $group->getName();
?>
" type="text" disabled="disabled" class="form-control" id="name" name="name">
예제 #11
0
					<div class="alert alert-danger">
						<?php 
    echo DinklyFlash::get('reset_error');
    ?>
						<button type="button" class="close message-close" aria-hidden="true">&times;</button>
					</div>
				<?php 
}
?>

				<?php 
if (DinklyFlash::exists('reset_success')) {
    ?>
					<div class="alert alert-success">
						<?php 
    echo DinklyFlash::get('reset_success');
    ?>
					</div>
				<?php 
}
?>
			</div>
		</div>

		<div class="row">
			<form class="form-inline" action="" method="post" style="padding-top: 50px;">
				<div class="form-group">
					<input placeholder="Enter new password" id="password" name="password" type="password" class="form-control">
				</div>
				<div class="form-group">
					<input placeholder="Confirm password" id="password-confirm" name="password-confirm" type="password" class="form-control">