Esempio n. 1
0
 public function init()
 {
     $this->setMethod('post');
     $userNs = new Zend_Session_Namespace('members');
     $userId = $userNs->userId;
     $where = "user_id='{$userId}' AND permission_id NOT IN(1)";
     $user_permission = new Application_Model_UserPermission();
     $user_permission = $user_permission->fetchAll($where);
     if (count($user_permission) > 0) {
         $group = new Application_Model_FriendGroup();
         $friendGroupArray = $group->getFriendGroup('--select--', null);
         //create permission array for Travel Wall Journals permission
         //$friendGroupJournalArray = array (""=>"--select--", "5"=>"Public", "4"=>"Just Me (private, hidden from everyone)");
         foreach ($user_permission as $_permission) {
             /*if($_permission->getPermissionId()==4)
             		{
             			$friendGroupArray = $friendGroupJournalArray;
             		}
             		else
             		{
             			$friendGroupArray = $friendGroupNewArray;
             		}*/
             $this->addElement('select', "friend_group_id_" . $_permission->getPermissionId(), array('label' => $_permission->getPermissionName() . " : ", 'class' => 'form', 'TABINDEX' => '6', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select group')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $friendGroupArray, 'value' => $_permission->getFriendGroupId()));
         }
         $this->addElement('submit', 'submit', array('required' => false, 'class' => 'signup', 'TABINDEX' => '20', 'ignore' => true, 'label' => 'Save', 'decorators' => $this->buttonDecorators));
     }
 }
Esempio n. 2
0
 public function init()
 {
     // Set the method for the display form to POST
     $this->setMethod('post');
     $this->addElementPrefixPath('Base_Validate', 'Base/Validate/', 'validate');
     $arrWeight = array();
     $arrWeight[0] = "--Select--";
     for ($i = 1; $i <= 50; $i++) {
         $arrWeight[$i] = $i;
     }
     // Add an email element
     $this->addElement('text', 'title', array('label' => 'Enter title', 'required' => true, 'class' => "form", 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Post title can not be left blank.'))), array('Alphachar', true, array('messages' => array('alnumStringNotValid' => 'Please remove special characters.'))))));
     //default selected Status option as per permission settings
     $userNs = new Zend_Session_Namespace('members');
     $userId = $userNs->userId;
     $where = "user_id='{$userId}' AND permission_id=4";
     $user_permission = new Application_Model_UserPermission();
     $user_permission = $user_permission->fetchRow($where);
     $savedUserPermission = $user_permission->getFriendGroupId();
     $selectedPermission = "public";
     if ($savedUserPermission == 4) {
         $selectedPermission = "private";
     }
     $arrStatus = array("public" => "Public", "private" => "Just Me");
     //get user permission and create new dropdwon, added by Mahipal Adhikari on 28-Mar-2011
     $group = new Application_Model_FriendGroup();
     $arrStatus = $group->getFriendGroup('--select--', null);
     $selectedPermission = $savedUserPermission;
     $this->addElement('select', 'status', array('label' => 'Permissions', 'class' => 'form', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select journal post permission.')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'value' => $selectedPermission, 'MultiOptions' => $arrStatus));
     //$arrStatus=Array("Public"=>"Public(Default)", "friends"=>"Friends and Family","travel"=>"Travel Mates","family"=>"Friends Family And Mates");
     $category = new Application_Model_Category();
     $arrCategory = $category->getCategory("-- Select Category --", "blog");
     $this->addElement('select', 'categoryId', array('label' => 'Choose post category', 'class' => 'form', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select the category.')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $arrCategory));
     $this->addElement('text', 'location', array('label' => 'Enter destination', 'class' => "form", 'required' => true, 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Destination can not be left blank.'))))));
     $this->addElement('textarea', 'tags', array('label' => 'Tag your post', 'required' => false, 'class' => 'blog_tag_textarea', 'rows' => '4', 'cols' => '40', 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim')));
     $this->addElement('textarea', 'content', array('label' => 'Edit your post', 'required' => true, 'rows' => '8', 'cols' => '80', 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array("messages" => array('isEmpty' => 'Journal entry can not be left blank.'))))));
     $this->addElement('radio', 'comment', array('label' => 'Enable Comments ', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enable comment.')))), 'multiOptions' => array('yes' => "Yes", 'no' => "No"), 'separator' => "  ", 'decorators' => $this->elementDecorators, 'value' => 'yes'));
     $this->addElement('radio', 'publish', array('label' => 'Publish Settings', 'required' => true, 'multiOptions' => array('published' => "Publish Live", 'draft' => "Save for Later"), 'value' => 'published', 'separator' => "  ", 'decorators' => $this->elementDecorators));
     $this->addElement('select', 'weight', array('label' => 'Weight', 'class' => 'form', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select the status')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $arrWeight));
     // Add the submit button
     $this->addElement('submit', 'submit', array('ignore' => true, 'label' => 'Create Post', 'decorators' => $this->buttonDecorators));
 }
Esempio n. 3
0
 public function init()
 {
     // Set the method for the display form to POST
     $this->setMethod('post');
     $Name = new Zend_Form_Element_Text('name');
     $Name->setLabel('Name of Album')->setAttrib('class', 'form')->setAttrib('id', 'name_of_album')->setValue('Title of Album')->setRequired(true)->clearDecorators()->addDecorators($this->elementDecorators);
     $Description = new Zend_Form_Element_Textarea('description');
     $Description->setLabel('Description')->setAttrib('rows', 5)->setAttrib('cols', 33)->addFilter('StripTags')->addFilter('StringTrim')->setRequired(true)->clearDecorators()->addDecorators($this->elementDecorators);
     $Location = new Zend_Form_Element_Text('address');
     $Location->setLabel('Album Location')->setAttrib('id', 'address')->setAttrib('class', 'form')->setRequired(true)->clearDecorators()->addDecorators($this->elementDecorators);
     $LatLng = new Zend_Form_Element_Hidden('latlang');
     $LatLng->setLabel('')->setAttrib('id', 'latlang')->setAttrib('class', 'form')->clearDecorators()->addDecorators($this->elementDecorators);
     $objModelFriendGroup = new Application_Model_FriendGroup();
     $arrFriendGroup = $objModelFriendGroup->getPermissions();
     $Permissions = new Zend_Form_Element_Select('permissions');
     $Permissions->setAttrib('id', 'permissions')->setAttrib('class', 'input')->setRequired(true)->addMultiOptions($arrFriendGroup)->clearDecorators()->addDecorators($this->elementDecorators);
     $Tags = new Zend_Form_Element_Textarea('tags');
     $Tags->setLabel('Album Tags')->setAttrib('rows', 5)->setAttrib('cols', 33)->setAttrib('class', 'form')->setAttrib('id', 'album_tags')->setValue("Seperate Tags by a comma. For example:Holiday,London,Travel")->addFilter('StripTags')->addFilter('StringTrim')->clearDecorators()->addDecorators($this->elementDecorators);
     $Upload = new Zend_Form_Element_Button('upload');
     $Upload->setAttrib('id', 'upload')->setAttrib('class', 'button')->setLabel('UPLOAD PHOTOS')->clearDecorators()->addDecorators($this->buttonDecorators);
     $Save = new Zend_Form_Element_Submit('save');
     $Save->setAttrib('id', 'save')->setAttrib('class', 'button')->setLabel('CREATE & SAVE ALBUM')->clearDecorators()->addDecorators($this->buttonDecorators);
     $this->addElements(array($Name, $Description, $Location, $LatLng, $Permissions, $Tags, $Upload, $Save));
 }
 public function editAction()
 {
     $this->view->title = "FriendGroup - Edit";
     $this->view->headTitle(" -  " . $this->view->title);
     $id = $this->_getParam('id');
     $model1 = new Application_Model_FriendGroup();
     $model = $model1->find($id);
     $options['name'] = $model->getName();
     $request = $this->getRequest();
     $form = new Admin_Form_FriendGroup();
     $form->populate($options);
     $options = $request->getPost();
     if ($request->isPost()) {
         if ($form->isValid($options)) {
             $model->setOptions($options);
             $model->save($model);
             $this->view->successMsg = "FriendGroup Id : {$model->getId()}' has been updated successfully!";
         } else {
             $form->reset();
             $form->populate($options);
         }
     }
     $this->view->form = $form;
 }
Esempio n. 5
0
 public function albumPhotoEditAction()
 {
     $this->_helper->layout()->disableLayout();
     $objModelFriendGroup = new Application_Model_FriendGroup();
     $objModelAlbum = new Album_Model_Album();
     $objModelAlbumPhoto = new Album_Model_AlbumPhoto();
     $arrPostVal = $this->getRequest()->getParams();
     $photoId = $arrPostVal['photoId'];
     $albumId = $arrPostVal['albumId'];
     $this->getPhotoInfo($photoId, $albumId);
     /*----------- GET ALL PERMISSION --------------*/
     $arrFriendGroup = $objModelFriendGroup->getPermissions();
     $this->view->arrFriendGroup = $arrFriendGroup;
     /*----------- GET ALBUM TAG ------------------*/
     $this->view->albumPhotoTag = $albumPhotoTag = $objModelAlbumPhoto->getAlbumPhotoTags($photoId);
     $this->view->current_photo_id = $photoId;
     $this->view->current_album_id = $albumId;
     /*----------- GET ALL MY ALBUM ---------------*/
     $usersNs = new Zend_Session_Namespace("members");
     $userId = $usersNs->userId;
     $whereAlbum = "user_id='{$userId}' AND status='1'";
     $arrAlbumInfo = $objModelAlbum->fetchAll($whereAlbum);
     $arrAlbum = array();
     foreach ($arrAlbumInfo as $album) {
         $arrAlbum[$album->id] = $album->name;
     }
     $this->view->arrAlbum = $arrAlbum;
 }
Esempio n. 6
0
 private function setModel($row)
 {
     $model = new Application_Model_FriendGroup();
     $model->setId($row->id)->setName($row->name)->setAddedon($row->addedon)->setUpdatedon($row->updatedon)->setUserId($row->user_id);
     return $model;
 }
Esempio n. 7
0
 /**
  * @Created By : Mahipal Adhikari
  * @Created On : 29-Oct-2010
  * @Description: Used to save/update map location permission from where-i-am page
  */
 function updateLocationPermissionAction()
 {
     $this->view->layout()->disableLayout();
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender(true);
     $id = $this->getRequest()->getParam('perm_id');
     $friend_group_id = $this->getRequest()->getParam('friend_group_id');
     $response = "";
     $UserPermissionObj = new Application_Model_UserPermission();
     $UserPermissionObj = $UserPermissionObj->find($id);
     if (false !== $UserPermissionObj) {
         $UserPermissionObj->setFriendGroupId($friend_group_id);
         $respPermission = $UserPermissionObj->save();
         //set confirmation message to display
         if ($respPermission) {
             //get permission name to set selected
             $FriendGroupObj = new Application_Model_FriendGroup();
             $whereCond = "id='{$friend_group_id}'";
             $FriendGroup = $FriendGroupObj->fetchRow($whereCond);
             $PermissionName = $FriendGroup->getName();
             $response .= "<span style='color:#EF4733;'>Location permission has been saved.</span>";
             $JsonResultArray = array('msg' => $response, 'set_permission' => $PermissionName);
         } else {
             $response = "<span style='color:#EF4733;'>Error occured. Please try again later.</span>";
             $JsonResultArray = array('msg' => $response);
         }
     } else {
         $response = "<span style='color:#EF4733;'>Invalid request.</span>";
         $JsonResultArray = array('msg' => $response);
     }
     //sleep(5);
     echo Zend_Json::encode($JsonResultArray);
     exit;
 }