Ansel_Ajax_Application_Handler::setFaceName PHP Method

setFaceName() public method

Sets a name in an image.
public setFaceName ( )
    public function setFaceName()
    {
        global $injector, $registry;
        $face_id = intval($this->vars->face_id);
        $image_id = intval($this->vars->image_id);
        $name = $this->vars->face_name;
        $storage = $injector->getInstance('Ansel_Storage');
        $image = $storage->getImage($image_id);
        $gallery = $storage->getGallery($image->gallery);
        if (!$gallery->hasPermission($registry->getAuth(), Horde_Perms::EDIT)) {
            throw new Ansel_Exception('You are not allowed to edit this photo');
        }
        $injector->getInstance('Ansel_Faces')->setName($face_id, $name);
        $results = new stdClass();
        $results->results = Ansel_Faces::getFaceTile($face_id);
        return new Horde_Core_Ajax_Response($results);
    }