| Server IP : 213.186.33.2 / Your IP : 216.73.216.39 Web Server : Apache System : Linux webm005.cluster102.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64 User : symetry ( 21728) PHP Version : 8.2.31 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/s/y/m/symetry/www/ARCHIVES/application/controllers/ |
Upload File : |
<?php
/** @see Zend_Controller_Action */
require_once 'Zend/Controller/Action.php';
class ReferencesController extends Zend_Controller_Action
{
function preDispatch()
{
$auth = Zend_Auth::getInstance();
if (!$auth->hasIdentity()) {
$this->view->identified = false;
if (!$auth->hasIdentity()) {
$this->_redirect('Auth/Login');
}
}
else
{
$this->view->identified = true;
}
}
public function indexAction()
{
$references = new References();
$this->view->references = $references->fetchAll(null, 'ref_name ASC');
}
public function addAction()
{
$this->view->title = Zend_registry::get('translate')->_('AddReference');
$form = new FormReferences();
$form->submit->setLabel(Zend_registry::get('translate')->_('Add'));
$this->view->form = $form;
if ($this->_request->isPost()) {
$formData = $this->_request->getPost();
if ($form->isValid($formData)) {
$reference = new References();
$row = $reference->createRow();
$row->ref_type = $form->getValue('ref_type');
$row->ref_name = $form->getValue('ref_name');
$row->ref_description = $form->getValue('ref_description');
$row->ref_client = $form->getValue('ref_client');
$row->ref_street = $form->getValue('ref_street');
$row->ref_number = $form->getValue('ref_number');
$row->ref_bus = $form->getValue('ref_bus');
$row->ref_cp = $form->getValue('ref_cp');
$row->ref_city = $form->getValue('ref_city');
$row->save();
$this->_redirect('/References/');
} else {
$form->populate($formData);
}
}
}
public function delAction()
{
$this->view->title = Zend_registry::get('translate')->_('DelReference');
// confirmation has been done
if ($this->_request->isPost()) {
$id = (int)$this->_request->getPost('id');
$del = $this->_request->getPost('del');
if ($del == Zend_registry::get('translate')->_('Yes') && $id > 0) {
$reference = new References();
$where = 'ref_id = ' . $id;
$reference->delete($where);
}
$this->_redirect('/References/');
// confirmation has to be done
} else {
$id = (int)$this->_request->getParam('id');
if ($id > 0) {
$reference = new References();
$this->view->reference = $reference->fetchRow('ref_id='.$id);
}
}
}
public function modAction()
{
$this->view->title = Zend_registry::get('translate')->_('ModReference');
$form = new FormReferences();
$form->submit->setLabel(Zend_registry::get('translate')->_('Save'));
$this->view->form = $form;
if ($this->_request->isPost()) {
$formData = $this->_request->getPost();
if ($form->isValid($formData)) {
$reference = new References();
$id = (int)$form->getValue('ref_id');
$row = $reference->fetchRow('ref_id='.$id);
$where = 'ref_id = ' . $id;
$row->ref_type = $form->getValue('ref_type');
$row->ref_name = d($form->getValue('ref_name'));
$row->ref_description = d($form->getValue('ref_description'));
$row->ref_client = d($form->getValue('ref_client'));
$row->ref_street = d($form->getValue('ref_street'));
$row->ref_number = d($form->getValue('ref_number'));
$row->ref_bus = d($form->getValue('ref_bus'));
$row->ref_cp = d($form->getValue('ref_cp'));
$row->ref_city = d($form->getValue('ref_city'));
$row->save($where);
$this->_redirect('/References/');
} else {
$form->populate($formData);
}
} else {
// L'id de l'album est attendu dans $params['id']
$id = (int)$this->_request->getParam('id', 0);
if ($id > 0) {
$reference = new References();
$reference = $reference->fetchRow('ref_id='.$id);
$form->populate($reference->toArray());
}
}
}
}