<?php
/**
 * portfolio-model
 *
 * @package baseContent
 * @subpackage portfolio
 */
class app_portfolio_model extends fl_model {
	private $projects_per_page = 7;

	/**
	 * Projekte seitenweise ausgeben
	 *
	 * @param string $type
	 * @param int    $page
	 * @return LimitIterator
	 */
	public function get_projects($type, $page) {
		$method_name = "get_{$type}_projects";
		$projects = new ArrayIterator(
			$this->$method_name()
		);

		$offset = ( $this->projects_per_page * ($page-1) );
		$project_count = count($projects);

		$offset = ( $project_count < $offset )?
			0: $offset;

		$paged_projects = new LimitIterator(
			$projects, $offset, $this->projects_per_page
		);

		return $paged_projects;
	}

	/**
	 * Seitenlinks zurückgeben
	 *
	 * @param string $type
	 * @param string $link
	 * @param int    $page
	 * @return string
	 */
	public function get_project_pages($type, $link, $page) {
		$method_name = "get_{$type}_projects";
		$projects = $this->$method_name();

		$previous = ( $page > 1 )? $page - 1: 1;
		$last = ceil( count($projects) / $this->projects_per_page);
		$next = (  $page+1 <= $last )? $page + 1: $last;
		$pages = range(1, $last);

		$separator = ' <span class="separator"> | </span> ';

		$html = '';
		$html .= '<p class="page_navigator">';
		$html .= '<a href="/'.$link.'/'.$previous.'">&laquo;</a> ';
		$html .= $separator;
		foreach ( range(1, $last) as $p ) {
			$pstr = ( $page == $p )? '<b>'.$p.'</b>': $p;
			$html .= '<a href="/'.$link.'/'.$p.'">'.$pstr.'</a>';
			$html .= $separator;
		}
		$html .= '<a href="/'.$link.'/'.$next.'">&raquo;</a>';
		$html .= '</p>';

		return $html;
	}

	public function get_web_projects() {
		$projects = array();

		$projects[] = array(
			'title'=>'Die Deutsche Bibliothek',
			'url'=>'http://www.ddb.de',
			'assgiment'=>'Templatedesign',
			'client'=>'3-point concepts GmbH',
			'shortname'=>'ddb',
			'url_text'=>'Webseite besuchen'
		);

		$projects[] = array(
			'title'=>'Dietrich Bonhoeffer',
			'url'=>'http://handschriften.staatsbibliothek-berlin.de/bonhoeffer/',
			'assgiment'=>'Bildbearbeitung',
			'client'=>'3-point concepts GmbH',
			'shortname'=>'bonhoeffer',
			'url_text'=>'Webseite besuchen'
		);

		$projects[] = array(
			'title'=>'Deutscher Bibliotheksverband',
			'url'=>'http://www.bibliotheksportal.de',
			'assgiment'=>'Templatedesign/ Icongestaltung',
			'client'=>'3-point concepts GmbH',
			'shortname'=>'knb',
			'url_text'=>'Webseite besuchen'
		);

		$projects[] = array(
			'title'=>'CME-Springer',
			'url'=>'http://www.cme-springer.de',
			'assgiment'=>'Screendesign',
			'client'=>'BSMO GmbH',
			'shortname'=>'cme-springer',
			'url_text'=>'Webseite besuchen'
		);

		$projects[] = array(
			'title'=>'Jobcenter-Medizin',
			'url'=>'http://www.jobcenter-medizin.de',
			'assgiment'=>'Screendesign',
			'client'=>'BSMO GmbH',
			'shortname'=>'jobcenter-medizin',
			'url_text'=>'Webseite besuchen'
		);

		$projects[] = array(
			'url'=>'http://www.berlincitypoker.de',
			'shortname'=>'poker',
			'title'=>'Berlin City Poker',
			'client'=>'André K.',
			'assignment'=>'Kommunikationskonzept / Screendesign',
			'url_text'=>'Webseite besuchen'
		);

		$projects[] = array(
			'url'=>'http://www.viveo150.de',
			'shortname'=>'viveo',
			'title'=>'Viveo',
			'client'=>'Schütz &amp; co Werbeagentur',
			'assignment'=>'Navigationskonzept / Screendesign',
			'url_text'=>'Webseite besuchen'
		);

		$projects[] = array(
			'url'=>'http://weigend.com',
			'shortname'=>'weigend',
			'title'=>'Andreas S. Weigend',
			'client'=>'3-point concepts',
			'assignment'=>'Navigationskonzept / Screendesign',
			'url_text'=>'Webseite besuchen'
		);

		$projects[] = array(
			'url'=>'/public/img/web/sideshow/landingpage_03.jpg',
			'shortname'=>'jamba',
			'title'=>'Landingpage &quot;Rock&quot;',
			'client'=>'Jamba GmbH',
			'assignment'=>'Kommunikationskonzept / Screendesign',
			'url_text'=>' Screenshot'
		);

		$projects[] = array(
			'url'=>'http://nugg.ad',
			'shortname'=>'nuggad',
			'title'=>'nugg.ad',
			'client'=>'3-point concepts',
			'assignment'=>'Navigationskonzept / Screendesign',
			'url_text'=>'Webseite besuchen'
		);

		$projects[] = array(
			'url'=>'http://www.bpb.de/methodik/ZOAUGM,0,0,WahlOMat_Archiv.html',
			'shortname'=>'walomat',
			'title'=>'Wal-O-Mat',
			'client'=>'3-point concepts',
			'assignment'=>'Screendesign',
			'url_text'=>'Webseite besuchen'
		);

		$projects[] = array(
			'url'=>'http://www.bildungslueckenfueller.de/',
			'shortname'=>'bildung',
			'title'=>'Bildungslückenfüller',
			'client'=>'3-point concepts',
			'assignment'=>'Navigationskonzept / Screendesign',
			'url_text'=>'Webseite besuchen'
		);

		$projects[] = array(
			'url'=>'http://www.efors.eu/',
			'shortname'=>'efors',
			'title'=>'Efors Onlinemagazin',
			'client'=>'Work-Out',
			'assignment'=>'Navigationskonzept / Screendesign',
			'url_text'=>'Webseite besuchen'
		);

		$web_projects = array();
		foreach( $projects as $project ) {
			$web_projects[] = $this->factory->get_structure('portfolio/webdesign', $project);
		}

		return $web_projects;
	}

	public function get_print_projects() {
		$projects = array();
		
		$projects[] = array(
			'shortname'=>'dao',
			'title'=>'DAO',
			'client'=>'DAO - Kampfkunstschule',
			'assignment'=>'Drucksachen'
		);

		$projects[] = array(
			'shortname'=>'nanologika',
			'title'=>'nanoLogika',
			'client'=>'nanoLogika',
			'assignment'=>'Drucksachen'
		);
		
		$projects[] = array(
			'shortname'=>'corpuscare',
			'title'=>'corpuscare',
			'client'=>'corpuscare',
			'assignment'=>'Drucksachen'
		);

		$projects[] = array(
			'shortname'=>'poker',
			'title'=>'Berlin City Poker',
			'client'=>'Berlin City Poker',
			'assignment'=>'Drucksachen'
		);

		$projects[] = array(
			'shortname'=>'nobilis',
			'title'=>'Nobilis',
			'client'=>'Nobilis',
			'assignment'=>'Corporate Identity'
		);

		/**
		$projects[] = array(
			'shortname'=>'giata',
			'title'=>'GIATA Videoaufsteller',
			'client'=>'GIATA mbH',
			'assignment'=>'Drucksachen'
		);
		 */

		$projects[] = array(
			'shortname'=>'rampenlicht',
			'title'=>'Rampenlicht',
			'client'=>'Rampenlicht',
			'assignment'=>'Visitenkarten'
		);
	
		$print_projects = array();
		foreach( $projects as $project ) {
			$print_projects[] = $this->factory->get_structure('data', $project);
		}

		return $print_projects;
	}

	public function get_logo_projects() {
		$projects = array();

		$projects[] = array(
			'shortname'=>'myhotelvideo',
			'title'=>'MyHotelVideo',
			'client'=>'GIATA mbH'
		);

		$projects[] = array(
			'shortname'=>'nanologika',
			'title'=>'nanoLogika',
			'client'=>'nanoLogika'
		);

		$projects[] = array(
			'shortname'=>'travelclips',
			'title'=>'travelClips',
			'client'=>'travelClips'
		);

		$projects[] = array(
			'shortname'=>'corpuscare',
			'title'=>'corpusCare',
			'client'=>'corpusCare'
		);
	
		$projects[] = array(
			'shortname'=>'nobilis',
			'title'=>'Nobilis',
			'client'=>'Nobilis'
		);


		$logo_projects = array();
		foreach( $projects as $project ) {
			$logo_projects[] = $this->factory->get_structure('data', $project);
		}

		return $logo_projects;
	}
}