当前位置: 首页>>代码示例>>PHP>>正文


PHP Avatar::delete方法代码示例

本文整理汇总了PHP中Avatar::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Avatar::delete方法的具体用法?PHP Avatar::delete怎么用?PHP Avatar::delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Avatar的用法示例。


在下文中一共展示了Avatar::delete方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: supprimerutilisateurAction

 function supprimerutilisateurAction()
 {
     $this->view->title = "Suppression d'un utilisateur";
     $utilisateuradmin = new Utilisateur();
     $utilisateur = new Utilisateur();
     $avatar = new Avatar();
     $objet = new LigneInventaire();
     $compavatar = new AvatarCompetence();
     $id = $this->_request->getParam('id');
     $utilisateur = $utilisateur->findById($id);
     // L'admin ne peut pas supprimer son propre compte !
     if ($utilisateuradmin->isAdmin($id)) {
         $this->_redirect('admin/utilisateur');
         return;
     }
     if ($this->_request->isPost()) {
         $del = $this->_request->getPost('del');
         if ($del == 'Oui' && $id > 0) {
             // Recuperation de tous les avatars de l'utilisateur
             $avatars = $avatar->findByUser($id);
             foreach ($avatars as $avatar) {
                 // Recuperation des competences de chaque avatar
                 $compavatars = $compavatar->findByIdAvatar($avatar->id_avatar);
                 foreach ($compavatars as $compavatar) {
                     $compavatar->delete('id_competence = ' . $compavatar->id_competence);
                 }
                 // Suppression des competences
                 $compavatar = new AvatarCompetence();
                 // Recuperation des objets de chaque avatar
                 $objets = $objet->findByIdAvatar($avatar->id_avatar);
                 foreach ($objets as $objet) {
                     $objet->delete('id_objet = ' . $objet->id_objet);
                 }
                 // Suppression des objets
                 $objet = new LigneInventaire();
                 $avatar->delete('id_avatar = ' . $avatar->id_avatar);
                 //Suppression de l'avatar
             }
             $utilisateur = new Utilisateur();
             // Recuperation de tous les avatars du joueur
             $where = "id_utilisateur = " . $id;
             $utilisateur->delete($where);
         }
         $this->_redirect('admin/utilisateur');
         return;
     }
     $this->view->utilisateur = $utilisateur;
 }
开发者ID:Zabu,项目名称:MTA,代码行数:48,代码来源:AdminController.php

示例2: getUploaded

 public static function getUploaded(Profile $target)
 {
     $avatar = new Avatar();
     $avatar->profile_id = $target->id;
     $avatar->original = true;
     if (!$avatar->find(true)) {
         throw new NoAvatarException($target, $avatar);
     }
     if (!file_exists(Avatar::path($avatar->filename))) {
         // The delete call may be odd for, say, unmounted filesystems
         // that cause a file to currently not exist, but actually it does...
         $avatar->delete();
         throw new NoAvatarException($target, $avatar);
     }
     return $avatar;
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:16,代码来源:Avatar.php

示例3: Avatar

 /**
  * Delete attached avatars for this user from the database and filesystem.
  * This should be used instead of a batch delete() to ensure that files
  * get removed correctly.
  *
  * @param boolean $original true to delete only the original-size file
  * @return <type>
  */
 function delete_avatars($original = true)
 {
     $avatar = new Avatar();
     $avatar->profile_id = $this->id;
     $avatar->find();
     while ($avatar->fetch()) {
         if ($avatar->original) {
             if ($original == false) {
                 continue;
             }
         }
         $avatar->delete();
     }
     return true;
 }
开发者ID:microcosmx,项目名称:experiments,代码行数:23,代码来源:Profile.php

示例4: supprimeravatarAction

 function supprimeravatarAction()
 {
     $this->view->title = "Suppression de l'avatar";
     $avatar = new Avatar();
     if ($this->_request->isPost()) {
         Zend_Loader::loadClass('Zend_Filter_Alpha');
         $filter = new Zend_Filter_Alpha();
         $id = (int) $this->_request->getPost('id');
         $del = $filter->filter($this->_request->getPost('del'));
         if ($del == 'Oui' && $id > 0) {
             $where = $avatar->getAdapter()->quoteInto('id_avatar =?', $id);
             $rows_affected = $avatar->delete($where);
             $fichier = $_SERVER['DOCUMENT_ROOT'] . '/Magic_TA/public/images/avatar/' . $id . ".png";
             unlink($fichier);
         }
         $this->_redirect('avatar/avatar');
     } else {
         $id = (int) $this->_request->getParam('id');
         $this->user = Zend_Auth::getInstance()->getIdentity();
         if (avatarViolation($id, $this->user->id_utilisateur)) {
             $this->_redirect('avatar/avatar');
             return;
         }
         if ($id > 0) {
             $this->view->avatar = $avatar->fetchRow('id_avatar=' . $id);
             if ($this->view->avatar->id_avatar > 0) {
                 return;
             } else {
                 $this->_redirect('avatar/avatar');
             }
         }
     }
 }
开发者ID:Zabu,项目名称:MTA,代码行数:33,代码来源:AvatarController.php


注:本文中的Avatar::delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。