當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Contacts::getAdapter方法代碼示例

本文整理匯總了PHP中Contacts::getAdapter方法的典型用法代碼示例。如果您正苦於以下問題:PHP Contacts::getAdapter方法的具體用法?PHP Contacts::getAdapter怎麽用?PHP Contacts::getAdapter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Contacts的用法示例。


在下文中一共展示了Contacts::getAdapter方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: deleteprofileimageAction

 public function deleteprofileimageAction()
 {
     $staff = new Contacts();
     $staffs = $staff->getImage($this->_getParam('id'));
     foreach ($staffs as $staff) {
         $filename = $staff['image'];
     }
     $updateData = array();
     $updateData['image'] = NULL;
     $updateData['updated'] = $this->getTimeForForms();
     $updateData['updatedBy'] = $this->getIdentityForForms();
     $stafflist = new Contacts();
     $where = $stafflist->getAdapter()->quoteInto('id = ?', (int) $this->_getParam('id'));
     $stafflist->update($updateData, $where);
     $name = substr($filename, 0, strrpos($filename, '.'));
     $ext = '.jpg';
     $converted = $name . $ext;
     unlink('./images/staffphotos/' . $filename);
     unlink('./images/staffphotos/resized/' . $converted);
     unlink('./images/staffphotos/thumbnails/' . $converted);
 }
開發者ID:rwebley,項目名稱:Beowulf---PAS,代碼行數:21,代碼來源:AjaxController.php

示例2: imageAction

 /** Change your staff profile image
  */
 public function imageAction()
 {
     $people = $this->_contacts->fetchRow($this->_contacts->select()->where('dbaseID = ' . $this->getIdentityForForms()));
     if (is_null($people)) {
         throw new Pas_Exception('Admin has not yet set up a profile for you');
     }
     $this->view->contacts = $people->toArray();
     $currentimage = $people->image;
     $form = new AddStaffPhotoForm();
     $this->view->form = $form;
     if ($this->_request->isPost()) {
         $formData = $this->_request->getPost();
         if ($form->isValid($formData)) {
             $upload = new Zend_File_Transfer_Adapter_Http();
             $upload->addValidator('NotExists', true, array('./assets/staffphotos/'));
             if ($upload->isValid()) {
                 $filename = $form->getValue('image');
                 $largepath = self::PROFILEPATH;
                 $original = $largepath . $filename;
                 $name = substr($filename, 0, strrpos($filename, '.'));
                 $ext = '.jpg';
                 $converted = $name . $ext;
                 $insertData = array();
                 $insertData['image'] = $converted;
                 $insertData['updated'] = $this->getTimeForForms();
                 $insertData['updatedBy'] = $this->getIdentityForForms();
                 foreach ($insertData as $key => $value) {
                     if (is_null($value) || $value == "") {
                         unset($insertData[$key]);
                     }
                 }
                 $smallpath = self::PROFILEPATH . 'thumbnails/' . $converted;
                 $mediumpath = self::PROFILEPATH . 'resized/' . $converted;
                 //create medium size
                 $phMagick = new phMagick($original, $mediumpath);
                 $phMagick->resize(400, 0);
                 $phMagick->convert();
                 /* Zend_Debug::dump($convertsmall);
                    Zend_Debug::dump($phMagick);
                    exit; */
                 $phMagick = new phMagick($original, $smallpath);
                 $phMagick->resize(80, 0);
                 $phMagick->convert();
                 $staffs = new Contacts();
                 $where = array();
                 $where[] = $staffs->getAdapter()->quoteInto('dbaseID  = ?', $this->getIdentityForForms());
                 $staffs->update($insertData, $where);
                 $upload->receive();
                 unlink(self::PROFILEPATH . 'thumbnails/' . $currentimage);
                 unlink(self::PROFILEPATH . $currentimage);
                 unlink(self::PROFILEPATH . 'resized/' . $currentimage);
                 $this->getFlash()->addMessage('The image has been resized and added to your profile.');
                 $this->redirect('/users/account/');
             } else {
                 $this->getFlash()->addMessage('There is a problem with your upload. Probably that image exists.');
                 $this->view->errors = $upload->getMessages();
             }
         } else {
             $form->populate($formData);
             $this->getFlash()->addMessage('Check your form for errors');
         }
     }
 }
開發者ID:lesleyauk,項目名稱:findsorguk,代碼行數:65,代碼來源:ProfileController.php

示例3: avatarAction

    /** provide an avatar for a contact
     */
    public function avatarAction()
    {
        $form = new AddStaffPhotoForm();
        $this->view->form = $form;
        if ($this->_request->isPost()) {
            $formData = $this->_request->getPost();
            if ($form->isValid($formData)) {
                $upload = new Zend_File_Transfer_Adapter_Http();
                $upload->addValidator('NotExists', true, array(self::STAFFPATH));
                if ($upload->isValid()) {
                    $filename = $form->getValue('image');
                    $insertData = array();
                    $insertData['image'] = $filename;
                    $insertData['updated'] = $this->getTimeForForms();
                    $insertData['updatedBy'] = $this->getIdentityForForms();
                    foreach ($insertData as $key => $value) {
                        if (is_null($value) || $value == "") {
                            unset($insertData[$key]);
                        }
                    }
                    $original = self::STAFFPATH . $filename;
                    $name = substr($filename, 0, strrpos($filename, '.'));
                    $ext = '.jpg';
                    $converted = $name . $ext;
                    $smallpath = self::STAFFPATH . 'thumbnails/' . $converted;
                    $mediumpath = self::STAFFPATH . 'resized/' . $converted;
                    //create medium size
                    $phMagick = new phMagick($original, $mediumpath);
                    $phMagick->resize(300, 0);
                    $phMagick->convert();
                    /* Zend_Debug::dump($convertsmall);
                    	Zend_Debug::dump($phMagick);
                    	exit; */
                    $phMagick = new phMagick($original, $smallpath);
                    $phMagick->resize(100, 0);
                    $phMagick->convert();
                    $staffs = new Contacts();
                    $where = array();
                    $where[] = $staffs->getAdapter()->quoteInto('id = ?', $this->_getParam('id'));
                    $staffs->update($insertData, $where);
                    $upload->receive();
                    $this->_flashMessenger->addMessage('The image has been resized and zoomified!');
                    $this->_redirect('/admin/contacts/contact/id/' . $this->_getParam('id'));
                } else {
                    $this->_flashMessenger->addMessage('There is a problem with your upload. 
	Probably that image exists.');
                    $this->view->errors = $upload->getMessages();
                }
            } else {
                $form->populate($formData);
                $this->_flashMessenger->addMessage('Check your form for errors dude');
            }
        }
    }
開發者ID:rwebley,項目名稱:Beowulf---PAS,代碼行數:56,代碼來源:ContactsController.php


注:本文中的Contacts::getAdapter方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。