Permalink
Browse files

starting

  • Loading branch information...
1 parent 3b21c4c commit 59aa2df8e6da6b5f5dd2775067a25e8b3de875b5 Eli hayun committed Nov 17, 2011
@@ -2,6 +2,7 @@
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap {
+
protected function _initjQuery() {
$this->bootstrap('view');
$view = $this->getResource('view'); //get the view object
@@ -75,6 +76,14 @@ public function _initRoutes() {
);
$router->addRoute('tenantsid', $route);
}
+ protected function _initMenu() {
+ $this->bootstrap('layout');
+ $layout = $this->getResource('layout');
+ $view = $layout->getView();
+ $config = new Zend_Config_Xml(APPLICATION_PATH . '/configs/mainmenu.xml', 'nav');
+ $mainmenu = new Zend_Navigation($config);
+ $view->navigation($mainmenu);
+ }
}
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Document : mainmenu.xml
+ Created on : August 11, 2011, 8:20 PM
+ Author : eli
+ Description:
+ Purpose of the document follows.
+-->
+
+<configdata>
+ <nav>
+
+
+ <tenants>
+ <label>דיירים</label>
+ <uri>/tenants</uri>
+ </tenants>
+
+ <tickets>
+ <label>תקלות</label>
+ <uri>/tickets</uri>
+ </tickets>
+
+ <contacts>
+ <label>בעלי מקצוע</label>
+ <uri>/contacts</uri>
+ </contacts>
+
+
+ <projects>
+ <label>פרוייקטים</label>
+ <uri>/projects</uri>
+ </projects>
+
+ <lobby>
+ <id>lobby</id>
+ <label>לובי</label>
+ <uri>/</uri>
+ </lobby>
+
+ <polls>
+ <label>הצבעות</label>
+ <uri>/polls</uri>
+ </polls>
+
+ <ads>
+ <label>לוח מודעות</label>
+ <uri>/ads</uri>
+ </ads>
+
+ <forums>
+ <label>פורומים</label>
+ <uri>/forums</uri>
+ </forums>
+
+ <admin>
+ <label>ניהול</label>
+ <uri>/admin</uri>
+ </admin>
+
+ <help>
+ <label>
+ עזרה
+ </label>
+
+ <uri>/help</uri>
+ </help>
+
+ </nav>
+
+</configdata>
@@ -1,46 +1,80 @@
<?php
-class AuthController extends Zend_Controller_Action
-{
+class AuthController extends Zend_Controller_Action {
- public function init()
- {
+ public function init() {
/* Initialize action controller here */
}
- public function indexAction()
- {
- // action body
+ private function isValid($post) {
+ if (empty($post['email']))
+ return false;
+ if (empty($post['password']))
+ return false;
+ return true;
}
- public function loginAction()
- {
+ public function indexAction() {
// action body
}
- public function logoutAction()
- {
- // action body
+ public function loginAction() {
+ $this->view->topPageTitle = "כניסה למערכת";
+ $errmsg = '';
+ if ($this->getRequest()->isPost()) {
+ if ($this->isValid($_POST)) {
+ $data = $_POST;
+ $db = Zend_Db_Table::getDefaultAdapter();
+ $authAdapter = new Zend_Auth_Adapter_DbTable($db, 'tenants', 'tnt_email', 'tnt_password');
+ $authAdapter->setIdentity($data['email']);
+ $authAdapter->setCredential(md5($data['password']));
+ $result = $authAdapter->authenticate();
+ if ($result->isValid()) {
+ $uData = $authAdapter->getResultRowObject(
+ array('id', 'tnt_is_active', 'tnt_first_name', 'tnt_last_name', 'tnt_email',
+ 'tnt_is_vaad', 'tnt_is_admin'));
+ $isActive = $uData->tnt_is_active;
+ $isActive = true;
+ if ($isActive) {
+ $role = 'tenant';
+ if ($uData->tnt_is_vaad)
+ $role = 'vaad';
+ if ($uData->tnt_is_admin)
+ $role = 'admin';
+ $uData->role = $role;
+ $auth = Zend_Auth::getInstance();
+ $storage = $auth->getStorage();
+ $storage->write($uData);
+ if ($act == 'thankyou') {
+ $cont = 'index';
+ $act = 'index';
+ }
+ return $this->_redirect("/$cont/$act");
+ } else {
+ $errmsg = "מייל או סיסמא אינם נכונים. או שעדיין לא קיבלת הרשאה להיכנס מהוועד.";
+ }
+ } else {
+ $errmsg = "מייל או סיסמא אינם נכונים. או שעדיין לא קיבלת הרשאה להיכנס מהוועד.";
+ }
+ } else {
+ $errmsg = "אנא הכנס כתובת מייל וסיסמא תקפים";
+ }
+ echo $errmsg;
+ }
}
- public function registerAction()
- {
- // action body
+ public function logoutAction() {
+ Zend_Auth::getInstance()->ClearIdentity();
+ return $this->_redirect("/");
}
- public function chngpassAction()
- {
+ public function registerAction() {
// action body
}
+ public function chngpassAction() {
+ // action body
+ }
}
-
-
-
-
-
-
-
-
@@ -1,21 +1,26 @@
<?php
-class TenantsController extends Zend_Controller_Action
+class TenantsController extends Vaad_Controller_Action
{
-
+
public function init()
{
- /* Initialize action controller here */
+ $this->view->topPageTitle = 'דיירים';
}
public function indexAction()
{
- // action body
+ $tbl = new Vaad_DbTable_Tenants();
+ $this->view->rows = $tbl->fetchAll(null,'tnt_app_num Asc');
+
+ $page = $this->getPage();
+ $this->setPaginator($this->view->rows);
+
}
public function createAction()
{
- // action body
+ $tbl = new Vaad_DbTable_Tenants();
}
public function listAction()
@@ -15,31 +15,25 @@
</head>
<body>
<div class='container main-page'>
- <div class="span-24 header last">
- akljhsdjkahsdjkahs
+ <div id="mainmenu" class="span-24 header last">
+ <?php echo $this->navigation()->menu(); ?>
</div>
<div class="span-24 dashboard">
<div class="span-6 search left">
<form method="post">
- <input size="15" type="text" value="חיפוש..." />
+ <input size="15" type="text" placeholder="חיפוש..." />
</form>
</div>
<div class="span-12 left page-title">
- ברוכים הבאים
+ <?php if (isset($this->topPageTitle)) echo $this->topPageTitle; ?>
</div>
+ <div id="logo"><?php echo $this->BldName(); ?></div>
</div>
- <div class="span-3 sidebar right">
+ <div class="span-4 sidebar right">
<?php echo $this->myDetails(); ?>
</div>
<div class='main-content span-19 left' >
<?php echo $this->layout()->content; ?>
- <div class="span-19 last break"> <hr> </div>
- <div class="span-9 showgrid left">
- sdlfjskldjfklsjd a;lkl;aksdl;
- askdl;aksdl;kal;s d;alskd a;sdkl;ask
- as;ldkl;aksdl;aks ;laksd ;askd a;sk
- </div>
- <div class="span-9 showgrid right"> kldfjksdjfsldjf sd</div>
</div>
<div class="footer span-24">
alkjklasjkl
@@ -12,12 +12,19 @@
skjdhfjkshd fkjshdf skjdfh skdfh skjdfh skjdfh skdfh sdkfhs dkfjhs dfjkhs dfkjshd kjsdhf ksjdfh skjdh
skjdhfjkshd fkjshdf skjdfh skdfh skjdfh skjdfh skdfh sdkfhs dkfjhs dfjkhs dfkjshd kjsdhf ksjdfh skjdh
skjdhfjkshd fkjshdf skjdfh skdfh skjdfh skjdfh skdfh sdkfhs dkfjhs dfjkhs dfkjshd kjsdhf ksjdfh skjdh
-
+
skjdhfjkshd fkjshdf skjdfh skdfh skjdfh skjdfh skdfh sdkfhs dkfjhs dfjkhs dfkjshd kjsdhf ksjdfh skjdh
skjdhfjkshd fkjshdf skjdfh skdfh skjdfh skjdfh skdfh sdkfhs dkfjhs dfjkhs dfkjshd kjsdhf ksjdfh skjdh
skjdhfjkshd fkjshdf skjdfh skdfh skjdfh skjdfh skdfh sdkfhs dkfjhs dfjkhs dfkjshd kjsdhf ksjdfh skjdh
skjdhfjkshd fkjshdf skjdfh skdfh skjdfh skjdfh skdfh sdkfhs dkfjhs dfjkhs dfkjshd kjsdhf ksjdfh skjdh
skjdhfjkshd fkjshdf skjdfh skdfh skjdfh skjdfh skdfh sdkfhs dkfjhs dfjkhs dfkjshd kjsdhf ksjdfh skjdh
-
+
</div>
+
+<div class="span-19 last break"> <hr> </div>
+<div class="span-9 showgrid left">
+ fff
+</div>
+<div class="span-9 showgrid right"> kldfjksdjfsldjf sd</div>
+
@@ -0,0 +1,28 @@
+<div class="pagination" >
+ <div>
+ <!-- Previous page link -->
+
+ <?php if (isset($this->previous)): ?>
+ <a href="<?php echo $this->url(array('page' => $this->previous)); ?>">
+ < הקודם
+ </a>
+ <?php endif; ?>
+ <!-- Numbered page links -->
+ <?php foreach ($this->pagesInRange as $page): ?>
+ <?php if ($page != $this->current): ?>
+ <a href="<?php echo $this->url(array('page' => $page)); ?>"><?php echo $page; ?></a>
+ <?php else: ?>
+ <?php echo "<span class='current'>" . $page . "</span>"; ?>
+ <?php endif; ?>
+ <?php endforeach; ?>
+ <!-- Next page link -->
+ <?php if (isset($this->next)): ?>
+ <a href="<?php echo $this->url(array('page' => $this->next)); ?>">
+ הבא >
+ </a>
+
+ <?php endif; ?>
+ <!-- Last page link -->
+ &nbsp; דף <?php echo $this->current; ?> מתוך <?php echo $this->last; ?>
+ </div>
+</div>
@@ -1,4 +1,10 @@
-<br /><br />
<div id="view-content">
- <p>View script for controller <b>Tenants</b> and script/action name <b>index</b></p>
+ <?php
+ foreach ($this->paginator as $row) {
+ $name = $row->tnt_first_name . ' ' . $row->tnt_last_name . "(" . $this->getApt($app) . ")";
+ echo "<a href='/tenants/view/" . $row->id . "'>$name</a><br>";
+ echo $row->tnt_app_phone. ' ' . $row->tnt_email . "<br>";
+ }
+ ?>
+ <?php echo $this->paginationControl($this->paginator, 'Sliding', 'pagination.phtml') ?>
</div>
@@ -1,4 +1,3 @@
-<br /><br />
<div id="view-content">
<p>View script for controller <b>Tenants</b> and script/action name <b>view</b></p>
</div>
Oops, something went wrong.

0 comments on commit 59aa2df

Please sign in to comment.