This repository has been archived by the owner on Jan 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Began building out photos component.
- Loading branch information
1 parent
91be30e
commit 398d539
Showing
13 changed files
with
301 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<?php | ||
/** | ||
* @version $Id$ | ||
* @package Appleseed.Components | ||
* @subpackage Photos | ||
* @copyright Copyright (C) 2004 - 2010 Michael Chisari. All rights reserved. | ||
* @link http://opensource.appleseedproject.org | ||
* @license GNU General Public License version 2.0 (See LICENSE.txt) | ||
*/ | ||
|
||
// Restrict direct access | ||
defined( 'APPLESEED' ) or die( 'Direct Access Denied' ); | ||
|
||
/** Photos Component Photo Controller | ||
* | ||
* Photos Component Photo Controller Class | ||
* | ||
* @package Appleseed.Components | ||
* @subpackage Photos | ||
*/ | ||
class cPhotosPhotoController extends cController { | ||
|
||
/** | ||
* Constructor | ||
* | ||
* @access public | ||
*/ | ||
public function __construct ( ) { | ||
parent::__construct( ); | ||
} | ||
|
||
public function Display ( $pView = null, $pData = array ( ) ) { | ||
|
||
$this->_Focus = $this->Talk ( 'User', 'Focus' ); | ||
|
||
$this->View = $this->GetView ( $pView ); | ||
|
||
$this->Set = $this->GetModel ( 'Sets' ); | ||
|
||
$this->Photos = $this->GetModel ( 'Photos' ); | ||
|
||
$Set = $this->GetSys ( 'Request' )->Get ( 'Set' ); | ||
$Identifier = $this->GetSys ( 'Request' )->Get ( 'Photo' ); | ||
|
||
$this->Set->Load ( $this->_Focus->Id, $Set ); | ||
$this->Set->Fetch(); | ||
|
||
$this->Photos->Load ( $Identifier ); | ||
$this->Photos->Fetch(); | ||
|
||
$this->_Prep(); | ||
|
||
$this->View->Display(); | ||
|
||
return ( true ); | ||
} | ||
|
||
private function _Prep ( ) { | ||
|
||
$id = $this->Photos->Get ( 'Photo_PK' ); | ||
|
||
$filename = $this->Photos->Get ( 'Filename' ); | ||
$extension = pathinfo ( $filename, PATHINFO_EXTENSION ); | ||
|
||
list ( $file ) = explode ( '.' . $extension, $filename ); | ||
|
||
$photoLocation = 'http://' . ASD_DOMAIN . '/_storage/photos/admin/' . $this->Set->Get ( 'Directory' ) . '/' . $file . '_n.' . $extension; | ||
$this->View->Find ( '.original', 0 )->src = $photoLocation; | ||
|
||
$this->View->Find ( '.description', 0 )->innertext = $this->Photos->Get ( 'Description' ); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
<?php | ||
/** | ||
* @version $Id$ | ||
* @package Appleseed.Components | ||
* @subpackage Photos | ||
* @copyright Copyright (C) 2004 - 2010 Michael Chisari. All rights reserved. | ||
* @link http://opensource.appleseedproject.org | ||
* @license GNU General Public License version 2.0 (See LICENSE.txt) | ||
*/ | ||
|
||
// Restrict direct access | ||
defined( 'APPLESEED' ) or die( 'Direct Access Denied' ); | ||
|
||
/** Photos Component Photos Controller | ||
* | ||
* Photos Component Photos Controller Class | ||
* | ||
* @package Appleseed.Components | ||
* @subpackage Photos | ||
*/ | ||
class cPhotosPhotosController extends cController { | ||
|
||
/** | ||
* Constructor | ||
* | ||
* @access public | ||
*/ | ||
public function __construct ( ) { | ||
parent::__construct( ); | ||
} | ||
|
||
public function Display ( $pView = null, $pData = array ( ) ) { | ||
|
||
$this->_Focus = $this->Talk ( 'User', 'Focus' ); | ||
|
||
$this->View = $this->GetView ( $pView ); | ||
|
||
$this->Set = $this->GetModel ( 'Sets' ); | ||
|
||
$this->Photos = $this->GetModel ( 'Photos' ); | ||
|
||
$Set = $this->GetSys ( 'Request' )->Get ( 'Set' ); | ||
|
||
$this->Set->Load ( $this->_Focus->Id, $Set ); | ||
$this->Set->Fetch(); | ||
|
||
$this->Photos->LoadFromSet ( $this->Set->Get ( 'Set_PK' ) ); | ||
|
||
$this->_Prep(); | ||
|
||
$this->View->Display(); | ||
|
||
return ( true ); | ||
} | ||
|
||
private function _Prep ( ) { | ||
|
||
$list = $this->View->Find ( '.list', 0); | ||
|
||
$item = $this->View->Find ( '.item', 0 ); | ||
|
||
$list->innertext = ""; | ||
|
||
while ( $this->Photos->Fetch() ) { | ||
$id = $this->Photos->Get ( 'Photo_PK' ); | ||
|
||
$filename = $this->Photos->Get ( 'Filename' ); | ||
$extension = pathinfo ( $filename, PATHINFO_EXTENSION ); | ||
|
||
$link = 'http://' . ASD_DOMAIN . '/profile/' . $this->_Focus->Username . '/photos/' . $this->Set->Get ( 'Directory' ) . '/' . $this->Photos->Get ( 'Identifier' ); | ||
$item->Find ( '.photo-link', 0 )->href = $link; | ||
|
||
list ( $file ) = explode ( '.' . $extension, $filename ); | ||
|
||
$photoLocation = 'http://' . ASD_DOMAIN . '/_storage/photos/admin/' . $this->Set->Get ( 'Directory' ) . '/' . $file . '_m.' . $extension; | ||
$item->Find ( '.photo', 0 )->src = $photoLocation; | ||
|
||
$item->Find ( '.description', 0 )->innertext = $this->Photos->Get ( 'Description' ); | ||
$list->innertext .= $item->outertext; | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
; @todo: refactor this into different views | ||
BACK_TO_PROFILE="« %userlink$s" | ||
BACK_TO_PHOTOSETS="« %userlink$s's Albums" | ||
BACK_TO_PHOTOSET="« %photosetlink$s" | ||
BACK_TO_PHOTOSETS="« <a href=\"%setlink$s\">%fullname$s's Albums</a>" | ||
BACK_TO_PHOTOSET="« <a href=\"%setlink$s\">%setname$s</a>" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
/** | ||
* @version $Id$ | ||
* @package Appleseed.Components | ||
* @subpackage Photos | ||
* @copyright Copyright (C) 2004 - 2010 Michael Chisari. All rights reserved. | ||
* @link http://opensource.appleseedproject.org | ||
* @license GNU General Public License version 2.0 (See LICENSE.txt) | ||
*/ | ||
|
||
// Restrict direct access | ||
defined( 'APPLESEED' ) or die( 'Direct Access Denied' ); | ||
|
||
/** Photos Component Photos Model | ||
* | ||
* Photos Component Photos Model Class | ||
* | ||
* @package Appleseed.Components | ||
* @subpackage Photos | ||
*/ | ||
class cPhotosModel extends cModel { | ||
|
||
protected $_Tablename = 'Photos'; | ||
|
||
/** | ||
* Constructor | ||
* | ||
* @access public | ||
*/ | ||
public function __construct ( $pTables = null ) { | ||
parent::__construct( $pTables ); | ||
} | ||
|
||
public function LoadFromSet ( $pSetId ) { | ||
$this->Retrieve ( array ( 'Set_FK' => $pSetId ) ); | ||
|
||
return ( true ); | ||
} | ||
|
||
public function Load ( $pIdentifier ) { | ||
|
||
$this->Retrieve ( array ( 'Identifier' => $pIdentifier ) ); | ||
|
||
return ( true ); | ||
} | ||
|
||
public function GetCover ( $pSetId ) { | ||
|
||
$this->Retrieve ( array ( 'Set_FK' => $pSetId ) ); | ||
$this->Fetch(); | ||
|
||
return ( true ); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<section class="photo"> | ||
|
||
<img class="original" /> | ||
<p class="description"></p> | ||
|
||
</section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<section class="photos"> | ||
|
||
<ul class="list"> | ||
<li class="item"> | ||
<a class="photo-link"><img class="photo" /></a> | ||
<p class="description"></p> | ||
<span class="count"></span> | ||
<abbr class="created"></abbr> | ||
</li> | ||
</ul> | ||
|
||
</section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
<section class="photosets"> | ||
|
||
<ul class="photosets list"> | ||
<li class="photosets item"> | ||
<ul class="list"> | ||
<li class="item"> | ||
<a class="photoset-cover-link"><img class="cover" /></a> | ||
<span="name"><a class="photoset-name-link">Photoset name</a></span> | ||
<span class="name"><a class="photoset-name-link">Photoset name</a></span> | ||
<p class="description">Photoset description</p> | ||
<span class="count"></span> | ||
<abbr class="created"></abbr> | ||
</li> | ||
</ul> | ||
|
||
</section> | ||
</section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters