Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

starting

  • Loading branch information...
commit 59aa2df8e6da6b5f5dd2775067a25e8b3de875b5 1 parent 3b21c4c
Eli hayun authored
View
9 application/Bootstrap.php
@@ -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);
+ }
}
View
72 application/configs/mainmenu.xml
@@ -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>
View
84 application/controllers/AuthController.php
@@ -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
+ }
}
-
-
-
-
-
-
-
-
View
15 application/controllers/TenantsController.php
@@ -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()
View
18 application/layouts/scripts/layout.phtml
@@ -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
View
11 application/views/scripts/index/index.phtml
@@ -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>
+
View
28 application/views/scripts/pagination.phtml
@@ -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>
View
10 application/views/scripts/tenants/index.phtml
@@ -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>
View
1  application/views/scripts/tenants/view.phtml
@@ -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>
View
68 css/vaad.css
@@ -8,19 +8,19 @@ body {
}
.main-page {
- background : url(/images/body.jpg) repeat-y;
+ background : url(/images/body.jpg) repeat-y;
}
.main-content {
- margin-right : 10px;
- min-height: 600px;
+ margin-right : 10px;
+ min-height: 600px;
}
.header {
height: 70px;
background: url(/images/menu.jpg) no-repeat;
-
+
}
.footer {
@@ -53,12 +53,30 @@ body {
padding-top : 5px;
}
+.pagination {
+ padding-top: 20px;
+}
+.pagination a , .current {
+ border: 1px solid #9AAFE5;
+ color: #0E509E;
+ font-weight: bold;
+ padding: 1px 6px;
+ text-decoration: none;
+}
+
+.pagination .current {
+ background-color: #2E6AB1;
+}
+
.box {
- background: url("/images/wrapper.png") no-repeat scroll 0 0 transparent;
+ /* background: url("/images/wrapper.png") no-repeat scroll 0 0 transparent; */
+ padding: 0;
+ /*padding-right: 7px;
+ padding-left: 7px;*/
+ background-color: #FADA6F;
border: 1px solid #CBC3BB;
list-style: none outside none;
- padding: 0;
width: 100%;
}
@@ -71,12 +89,42 @@ body {
text-align: center;
}
+.box .content {
+ padding: 7px;
+ padding-top: 0;
+}
+
+#logo {
+ font-family: Dorian;
+ padding-right: 10px;
+}
+#mainmenu {
+ font-family: Dorian;
+}
+
+#mainmenu ul li a {
+ background-color: transparent;
+ color: #FFFFFF;
+ font-size: 12px;
+ font-weight: bold;
+ padding: 5px 8px;
+ text-decoration: none;
+}
+
+#mainmenu ul {
+ margin: 0;
+ padding: 20px 20px 5px;
+}
+
+#mainmenu ul li {
+ display: inline;
+}
@font-face{
- font-family: 'Dorian';
- src: url('KtavYadCLMBoldItalic.ttf') format('truetype');
- font-weight: normal;
- font-style: normal;
+ font-family: 'Dorian';
+ src: url('KtavYadCLMBoldItalic.ttf') format('truetype');
+ font-weight: normal;
+ font-style: normal;
}
View
7 index.php
@@ -29,5 +29,12 @@
APPLICATION_ENV,
APPLICATION_PATH . '/configs/application.ini'
);
+$_ENV['TMP'] = $_SERVER['DOCUMENT_ROOT'] . '/tmp';
+
+if (isset($_REQUEST['params'])) {
+ $file = $_REQUEST['params'] . '.php';
+ include_once $file;
+}
+
$application->bootstrap()
->run();
View
26 library/Vaad/Controller/Action.php
@@ -0,0 +1,26 @@
+<?php
+
+class Vaad_Controller_Action extends Zend_Controller_Action {
+
+ protected $_page = 1;
+ protected $_paginator = null;
+
+ protected function getPage() {
+ $page = $this->_getParam('page', 0);
+ if ($page > 0)
+ $this->_page = $page;
+ return $this->_page;
+ ;
+ }
+
+ protected function setPaginator($result,$cnt=9) {
+ $this->_paginator = Zend_Paginator::factory($result);
+ $this->_paginator->setItemCountPerPage($cnt);
+ $this->_paginator->setCurrentPageNumber($this->getPage());
+
+ $this->view->paginator = $this->_paginator;
+ }
+
+}
+
+?>
View
63 library/Vaad/DbTable/Abstract.php
@@ -0,0 +1,63 @@
+<?php
+
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+/**
+ * Description of Abstract
+ *
+ * @author eli
+ */
+class Vaad_DbTable_Abstract extends Zend_Db_Table_Abstract {
+
+ protected $_tblCols = null;
+
+ private function hasColumn($name) {
+ if ($this->_tblCols == null) {
+ $db = $this->getAdapter();
+ $this->_tblCols = $db->describeTable($this->_name);
+ }
+
+ return isset($this->_tblCols[$name]);
+ }
+ private function hasBldid() {
+ return $this->hasColumn('bld_id');
+ }
+
+ private function hasSiteid() {
+ return $this->hasColumn('site_id');
+ }
+
+ protected function _fetch(Zend_Db_Table_Select $select) {
+ $bld_id = Zend_Registry::get('bld_id');
+ $site_id = Zend_Registry::get('site_id');
+
+ if ($bld_id) {
+ if ($this->hasBldid())
+ $select->where("bld_id = $bld_id");
+ }
+ if ($site_id) {
+ if ($this->hasSiteid())
+ $select->where("site_id = $site_id");
+ }
+
+ return parent::_fetch($select);
+ }
+
+ public function insert(array $data) {
+ $bld_id = Zend_Registry::get('bld_id');
+ $site_id = Zend_Registry::get('site_id');
+
+ if ($this->hasBldid())
+ $data['bld_id'] = $bld_id;
+ if ($this->hasSiteid())
+ $data['site_id'] = $site_id;
+
+ return parent::insert($data);
+ }
+
+}
+
+?>
View
22 library/Vaad/DbTable/Appartments.php
@@ -0,0 +1,22 @@
+<?php
+
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+/**
+ * Description of Tenants
+ *
+ * @author eli
+ */
+class Vaad_DbTable_Appartments extends Vaad_DbTable_Abstract {
+ protected $_name = 'appartments';
+
+ public function getAptNum($id) {
+
+ }
+
+}
+
+?>
View
18 library/Vaad/DbTable/Tenants.php
@@ -0,0 +1,18 @@
+<?php
+
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+/**
+ * Description of Tenants
+ *
+ * @author eli
+ */
+class Vaad_DbTable_Tenants extends Vaad_DbTable_Abstract {
+ protected $_name = 'tenants';
+
+}
+
+?>
View
11 library/Vaad/View/Helper/BldName.php
@@ -0,0 +1,11 @@
+<?php
+
+class Vaad_View_Helper_BldName extends Zend_View_Helper_Abstract {
+
+ public function bldname() {
+ return "מגדל עוז 1";
+ }
+
+}
+
+?>
View
12 library/Vaad/View/Helper/GetApt.php
@@ -0,0 +1,12 @@
+<?php
+
+class Vaad_View_Helper_GetApt extends Zend_View_Helper_Abstract {
+
+ public function getapt($id) {
+ $tbl = new Vaad_DbTable_Tenants();
+ return $tbl->GetAptNum($id);
+ }
+
+}
+
+?>
View
53 library/Vaad/View/Helper/MyDetails.php
@@ -1,31 +1,40 @@
<?php
+
class Vaad_View_Helper_MyDetails extends Zend_View_Helper_Abstract {
-public function mydetails() {
+ public function mydetails() {
-$html = "<div class = 'box can-hide'>"
-. "<div class = 'span-4 content'>"
-. "<h4> כניסה למערכת</h4>"
+ $html = "<div class = 'box can-hide span-4'>"
+ . "<div class = 'span-4'><div class='content'>"
;
-$auth = Zend_Auth::getInstance();
-if (!$auth->hasIdentity()) {
-}
-
-$html = $html . "<form action=\"/login\" method='post'>"
- //. "<label>כתובת דואר</label>"
- . "<input name='email' type = 'text' placeholder='כתובת מייל' size='15' />"
- //. "<label>סיסמא</label>"
- ." <input name='password' type = 'password' placeholder='סיסמא' size='15' />"
- . "<input type=\"submit\" name=\"submit\" id=\"submit\" value=\"הכנס\" class=\"submit\" />"
- ." <input type=\"submit\" name=\"register\" id=\"register\" value=\"הרשם\" class=\"submit\" />"
-. "</form>";
-
-
-$html = $html . "</div></div>";
-
-return $html;
-}
+ $auth = Zend_Auth::getInstance();
+ if ($auth->hasIdentity()) {
+ $identity = $auth->getIdentity();
+ $role = strtolower($identity->role);
+ $me = $identity->tnt_last_name . ' ' . $identity->tnt_first_name;
+ $id = $identity->id;
+ $logout = "<a href='/logout'> התנתק</a>";
+ $msg = "שלום " . "<a href='/tenants/view/$id'>$me</a>" . " $logout";
+ $html = $html . "$msg </div></div></div>";
+ return $html;
+ }
+
+ $html = $html . "<h4> כניסה למערכת</h4>";
+ $html = $html . "<form action=\"/login\" method='post'>"
+ //. "<label>כתובת דואר</label>"
+ . "<input name='email' type = 'text' placeholder='כתובת מייל' size='15' />"
+ //. "<label>סיסמא</label>"
+ . " <input name='password' type = 'password' placeholder='סיסמא' size='15' />"
+ . "<input type=\"submit\" name=\"submit\" id=\"submit\" value=\"הכנס\" class=\"submit\" />"
+ . " <input type=\"submit\" name=\"register\" id=\"register\" value=\"הרשם\" class=\"submit\" />"
+ . "</form>";
+
+
+ $html = $html . "</div></div></div>";
+
+ return $html;
+ }
}
View
4 library/moz1.php
@@ -0,0 +1,4 @@
+<?php
+
+Zend_Registry::set('site_id', 1);
+Zend_Registry::set('bld_id', 1);
Please sign in to comment.
Something went wrong with that request. Please try again.