本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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');
}
}
}
}