当前位置: 首页>>代码示例>>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;未经允许,请勿转载。