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


PHP Project::getMedium方法代码示例

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


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

示例1: project

 public function project($id)
 {
     $project = Project::getMedium($id, LANG);
     if (!$project instanceof Project) {
         throw new Redirection('/', Redirection::TEMPORARY);
     }
     return new View('view/widget/project.html.php', array('project' => $project, 'global' => true));
     throw new Redirection('/fail', Redirection::TEMPORARY);
 }
开发者ID:anvnguyen,项目名称:Goteo,代码行数:9,代码来源:widget.php

示例2: index

 public function index()
 {
     if (isset($_GET['error'])) {
         throw new \Goteo\Core\Error('418', Text::html('fatal-error-teapot'));
     }
     // orden de los elementos en portada
     $order = Home::getAll();
     // si estamos en easy mode, quitamos el feed
     if (defined('GOTEO_EASY') && \GOTEO_EASY === true && isset($order['feed'])) {
         unset($order['feed']);
     }
     // entradas de blog
     if (isset($order['posts'])) {
         // entradas en portada
         $posts = Post::getAll();
     }
     // Proyectos destacados
     if (isset($order['promotes'])) {
         $promotes = Promote::getAll(true);
         foreach ($promotes as $key => &$promo) {
             try {
                 $promo->projectData = Project::getMedium($promo->project, LANG);
             } catch (\Goteo\Core\Error $e) {
                 unset($promotes[$key]);
             }
         }
     }
     // actividad reciente
     if (isset($order['feed'])) {
         $feed = array();
         $feed['goteo'] = Feed::getAll('goteo', 'public', 15);
         $feed['projects'] = Feed::getAll('projects', 'public', 15);
         $feed['community'] = Feed::getAll('community', 'public', 15);
     }
     // Banners siempre
     /*            $banners   = Banner::getAll(true);
     
                 foreach ($banners as $id => &$banner) {
                     
                     if (!empty($banner->project)) {
                         try {
                             $banner->project = Project::get($banner->project, LANG);
                         } catch (\Goteo\Core\Error $e) {
                             unset($banners[$id]);
                         }
                     }
                     
                 }*/
     $template = VIEW_PATH . '/index.html.php';
     return new View($template, array('banners' => $banners, 'posts' => $posts, 'promotes' => $promotes, 'order' => $order));
 }
开发者ID:kenjs,项目名称:Goteo,代码行数:51,代码来源:index.php

示例3: confirmed

 public function confirmed($project = null, $id = null, $reward = null)
 {
     if (empty($id)) {
         Message::Error(Text::get('invest-data-error'));
         throw new Redirection('/', Redirection::TEMPORARY);
     }
     // el aporte
     $invest = Model\Invest::get($id);
     $projectData = Model\Project::getMedium($invest->project);
     // para evitar las duplicaciones de feed y email
     if (isset($_SESSION['invest_' . $invest->id . '_completed'])) {
         Message::Info(Text::get('invest-process-completed'));
         throw new Redirection($retUrl);
     }
     // segun método
     if ($invest->method == 'tpv') {
         // si el aporte no está en estado "cobrado por goteo" (1)
         if ($invest->status != '1') {
             @mail('goteo_fail@doukeshi.org', 'Aporte tpv no pagado ' . $invest->id, 'Ha llegado a invest/confirm el aporte ' . $invest->id . ' mediante tpv sin estado cobrado (llega con estado ' . $invest->status . ')');
             // mandarlo a la pagina de aportar para que lo intente de nuevo
             // si es de Bazar, a la del producto del catálogo
             if ($project == 'bazargoteo') {
                 throw new Redirection("/bazaar/{$reward}/fail");
             } else {
                 throw new Redirection("/project/{$invest->project}/invest/?confirm=fail");
             }
         }
     }
     // Paypal solo disponible si activado
     if ($invest->method == 'paypal') {
         // hay que cambiarle el status a 0
         $invest->setStatus('0');
         // Evento Feed
         $log = new Feed();
         $log->setTarget($projectData->id);
         $log->populate('Aporte PayPal', '/admin/invests', \vsprintf("%s ha aportado %s al proyecto %s mediante PayPal", array(Feed::item('user', $_SESSION['user']->name, $_SESSION['user']->id), Feed::item('money', $invest->amount . ' €'), Feed::item('project', $projectData->name, $projectData->id))));
         $log->doAdmin('money');
         // evento público
         $log_html = Text::html('feed-invest', Feed::item('money', $invest->amount . ' €'), Feed::item('project', $projectData->name, $projectData->id));
         if ($invest->anonymous) {
             $log->populate(Text::get('regular-anonymous'), '/user/profile/anonymous', $log_html, 1);
         } else {
             $log->populate($_SESSION['user']->name, '/user/profile/' . $_SESSION['user']->id, $log_html, $_SESSION['user']->avatar->id);
         }
         $log->doPublic('community');
         unset($log);
     }
     // fin segun metodo
     // Feed del aporte de la campaña
     if (!empty($invest->droped) && $drop instanceof Model\Invest && is_object($callData)) {
         // Evento Feed
         $log = new Feed();
         $log->setTarget($projectData->id);
         $log->populate('Aporte riego ' . $drop->method, '/admin/invests', \vsprintf("%s ha aportado %s de %s al proyecto %s a través de la campaña %s", array(Feed::item('user', $callData->user->name, $callData->user->id), Feed::item('money', $drop->amount . ' €'), Feed::item('drop', 'Capital Riego', '/service/resources'), Feed::item('project', $projectData->name, $projectData->id), Feed::item('call', $callData->name, $callData->id))));
         $log->doAdmin('money');
         // evento público
         $log->populate($callData->user->name, '/user/profile/' . $callData->user->id, Text::html('feed-invest', Feed::item('money', $drop->amount . ' €') . ' de ' . Feed::item('drop', 'Capital Riego', '/service/resources'), Feed::item('project', $projectData->name, $projectData->id) . ' a través de la campaña ' . Feed::item('call', $callData->name, $callData->id)), $callData->user->avatar->id);
         $log->doPublic('community');
         unset($log);
     }
     // texto recompensa
     // @TODO quitar esta lacra de N recompensas porque ya es solo una recompensa siempre
     $rewards = $invest->rewards;
     array_walk($rewards, function (&$reward) {
         $reward = $reward->reward;
     });
     $txt_rewards = implode(', ', $rewards);
     // recaudado y porcentaje
     $amount = $projectData->invested;
     $percent = floor($projectData->invested / $projectData->mincost * 100);
     // email de agradecimiento al cofinanciador
     // primero monto el texto de recompensas
     //@TODO el concepto principal sería 'renuncia' (porque todos los aportes son donativos)
     if ($invest->resign) {
         // Plantilla de donativo segun la ronda
         if ($projectData->round == 2) {
             $template = Template::get(36);
             // en segunda ronda
         } else {
             $template = Template::get(28);
             // en primera ronda
         }
     } else {
         // plantilla de agradecimiento segun la ronda
         if ($projectData->round == 2) {
             $template = Template::get(34);
             // en segunda ronda
         } else {
             $template = Template::get(10);
             // en primera ronda
         }
     }
     // Dirección en el mail (y version para regalo)
     $txt_address = Text::get('invest-address-address-field') . ' ' . $invest->address->address;
     $txt_address .= '<br> ' . Text::get('invest-address-zipcode-field') . ' ' . $invest->address->zipcode;
     $txt_address .= '<br> ' . Text::get('invest-address-location-field') . ' ' . $invest->address->location;
     $txt_address .= '<br> ' . Text::get('invest-address-country-field') . ' ' . $invest->address->country;
     $txt_destaddr = $txt_address;
     $txt_address = Text::get('invest-mail_info-address') . '<br>' . $txt_address;
     // Agradecimiento al cofinanciador
//.........这里部分代码省略.........
开发者ID:isbkch,项目名称:Goteo,代码行数:101,代码来源:invest.php

示例4: invested

 public static function invested($user, $publicOnly = true)
 {
     $projects = array();
     $sql = "SELECT project.id\r\n                    FROM  project\r\n                    INNER JOIN invest\r\n                        ON project.id = invest.project\r\n                        AND invest.user = ?\r\n                        AND invest.status IN ('0', '1', '3', '4')\r\n                    WHERE project.status < 7\r\n                    ";
     if ($publicOnly) {
         $sql .= "AND project.status >= 3\r\n                    ";
     }
     $sql .= "GROUP BY project.id\r\n                    ORDER BY name ASC\r\n                    ";
     /*
      * Restriccion de que no aparecen los que cofinancio que esten en edicion
      *  solamente no sacamos los caducados
      * project.status > 1 AND
      */
     $query = self::query($sql, array($user));
     foreach ($query->fetchAll(\PDO::FETCH_CLASS) as $proj) {
         $projects[] = \Goteo\Model\Project::getMedium($proj->id);
     }
     return $projects;
 }
开发者ID:isbkch,项目名称:Goteo,代码行数:19,代码来源:user.php

示例5: getMesseged

 public static function getMesseged($user, $publicOnly = true)
 {
     $projects = array();
     $sql = "SELECT project.id\n                    FROM  project\n                    INNER JOIN message\n                        ON project.id = message.project\n                        AND message.user = ?\n                    WHERE project.status < 7\n                    ";
     if ($publicOnly) {
         $sql .= "AND project.status >= 3\n                    ";
     }
     $sql .= "GROUP BY project.id\n                    ORDER BY name ASC\n                    ";
     $query = self::query($sql, array($user));
     foreach ($query->fetchAll(\PDO::FETCH_CLASS) as $proj) {
         $projects[] = \Goteo\Model\Project::getMedium($proj->id);
     }
     return $projects;
 }
开发者ID:anvnguyen,项目名称:Goteo,代码行数:14,代码来源:message.php

示例6: getContent

 public static function getContent($content, $lang = LANG)
 {
     // orden de los elementos en portada
     $order = \Goteo\Model\Home::getAll();
     // entradas de blog
     $posts_content = '';
     /*
                 if (isset($order['posts'])) {
        $home_posts = \Goteo\Model\Post::getList();
        if (!empty($home_posts)) {
     //                    $posts_content = '<div class="section-tit">'.Text::get('home-posts-header').'</div>';
            foreach ($posts as $id=>$title) {
                $the_post = \Goteo\Model\Post::get($id);
                $posts_content .= new View('view/email/newsletter_post.html.php', array('post'=>$the_post));
                break; // solo cogemos uno
            }
        }
                 }
     *
     */
     // Proyectos destacados
     $promotes_content = '';
     if (isset($order['promotes'])) {
         $home_promotes = \Goteo\Model\Promote::getAll(true, GOTEO_NODE, $lang);
         if (!empty($home_promotes)) {
             //                    $promotes_content = '<div class="section-tit">'.Text::get('home-promotes-header').'</div>';
             foreach ($home_promotes as $key => $promote) {
                 try {
                     $the_project = \Goteo\Model\Project::getMedium($promote->project, $lang);
                     $promotes_content .= new View('view/email/newsletter_project.html.php', array('promote' => $promote, 'project' => $the_project));
                 } catch (\Goteo\Core\Error $e) {
                     continue;
                 }
             }
         }
     }
     // capital riego
     $drops_content = '';
     /*
     if (isset($order['drops'])) {
         $calls     = \Goteo\Model\Call::getActive(3); // convocatorias en modalidad 1; inscripcion de proyectos
         $campaigns = \Goteo\Model\Call::getActive(4); // convocatorias en modalidad 2; repartiendo capital riego
     
         if (!empty($calls) || !empty($campaigns)) {
     //                    $drops_content = '<div class="section-tit">'.str_replace('<br />', ': ', Text::get('home-calls-header')).'</div>';
             // aqui lo del contenido dinamico
         }
     }
     */
     // montammos el contenido completo
     $tmpcontent = $content;
     foreach (\array_keys($order) as $item) {
         $var = $item . '_content';
         $tmpcontent .= ${$var};
     }
     return $tmpcontent;
 }
开发者ID:isbkch,项目名称:Goteo,代码行数:57,代码来源:newsletter.php

示例7: params

 /**
  * Metodo para realizar una busqueda por parametros
  * @param array multiple $params 'category', 'location', 'reward'
  * @param bool showall si true, muestra tambien proyectos en estado de edicion y revision
  * @return array results
  */
 public static function params($params, $showall = false, $limit = null)
 {
     $results = array();
     $where = array();
     $values = array();
     if (!empty($params['category'])) {
         $where[] = 'AND id IN (
                                 SELECT distinct(project)
                                 FROM project_category
                                 WHERE category IN (' . implode(', ', $params['category']) . ')
                             )';
     }
     if (!empty($params['location'])) {
         $where[] = 'AND MD5(project_location) IN (' . implode(', ', $params['location']) . ')';
     }
     if (!empty($params['reward'])) {
         $where[] = 'AND id IN (
                                 SELECT DISTINCT(project)
                                 FROM reward
                                 WHERE icon IN (' . implode(', ', $params['reward']) . ')
                                 )';
     }
     if (!empty($params['query'])) {
         $where[] = ' AND (name LIKE :text
                             OR description LIKE :text
                             OR motivation LIKE :text
                             OR about LIKE :text
                             OR goal LIKE :text
                             OR related LIKE :text
                             OR keywords LIKE :text
                             OR location LIKE :text
                         )';
         $values[':text'] = "%{$params['query']}%";
     }
     if (!empty($params['node'])) {
         $where[] = ' AND node = :node';
         $values[':node'] = NODE_ID;
     }
     if (!empty($params['status'])) {
         $where[] = ' AND status = :status';
         $values[':status'] = $params['status'];
     }
     $minstatus = $showall ? '1' : '2';
     $maxstatus = $showall ? '4' : '7';
     $sql = "SELECT id\n                    FROM project\n                    WHERE status > {$minstatus}\n                    AND status < {$maxstatus}\n                    ";
     if (!empty($where)) {
         $sql .= implode(' ', $where);
     }
     $sql .= " ORDER BY status ASC, name ASC";
     // Limite
     if (!empty($limit) && \is_numeric($limit)) {
         $sql .= " LIMIT {$limit}";
     }
     try {
         $query = Model::query($sql, $values);
         foreach ($query->fetchAll(\PDO::FETCH_CLASS) as $match) {
             $results[] = Project::getMedium($match->id);
         }
         return $results;
     } catch (\PDOException $e) {
         throw new Exception('Fallo la sentencia de busqueda');
     }
 }
开发者ID:isbkch,项目名称:Goteo,代码行数:69,代码来源:search.php

示例8: paid

 public function paid($id = null)
 {
     if ($_GET['result'] != 'ok') {
         die;
     }
     $id = $_GET['sendid'];
     if (empty($id)) {
         die;
     }
     // el aporte
     $invest = Model\Invest::get($id);
     if ($invest->status != "-1") {
         die;
     }
     $projectData = Model\Project::getMedium($invest->project);
     // para evitar las duplicaciones de feed y email
     if (isset($_SESSION['invest_' . $invest->id . '_completed'])) {
         die;
     }
     $user = Model\User::get($invest->user);
     // Paypal solo disponible si activado
     if ($invest->method == 'axes') {
         // hay que cambiarle el status a 0
         $invest->setStatus('0');
         // Evento Feed
         $log = new Feed();
         $log->setTarget($projectData->id);
         $log->populate('Aporte Axes', '/admin/invests', \vsprintf("%s ha aportado %s al proyecto %s mediante PayPal", array(Feed::item('user', $user->name, $user->id), Feed::item('money', $invest->amount . ' &yen;'), Feed::item('project', $projectData->name, $projectData->id))));
         $log->doAdmin('money');
         // evento público
         $log_html = Text::html('feed-invest', Feed::item('money', $invest->amount . ' &yen;'), Feed::item('project', $projectData->name, $projectData->id));
         if ($invest->anonymous) {
             $log->populate(Text::get('regular-anonymous'), '/user/profile/anonymous', $log_html, 1);
         } else {
             $log->populate($user->name, '/user/profile/' . $user->id, $log_html, $user->avatar->id);
         }
         $log->doPublic('community');
         unset($log);
     }
     // fin segun metodo
     // texto recompensa
     // @TODO quitar esta lacra de N recompensas porque ya es solo una recompensa siempre
     $rewards = $invest->rewards;
     array_walk($rewards, function (&$reward) {
         $reward = $reward->reward;
     });
     $txt_rewards = implode(', ', $rewards);
     // recaudado y porcentaje
     $amount = $projectData->invested;
     $percent = floor($projectData->invested / $projectData->mincost * 100);
     // email de agradecimiento al cofinanciador
     // primero monto el texto de recompensas
     //@TODO el concepto principal sería 'renuncia' (porque todos los aportes son donativos)
     if ($invest->resign) {
         // Plantilla de donativo segun la ronda
         if ($projectData->round == 2) {
             $template = Template::get(36);
             // en segunda ronda
         } else {
             $template = Template::get(28);
             // en primera ronda
         }
     } else {
         // plantilla de agradecimiento segun la ronda
         if ($projectData->round == 2) {
             $template = Template::get(34);
             // en segunda ronda
         } else {
             $template = Template::get(10);
             // en primera ronda
         }
     }
     // Dirección en el mail (y version para regalo)
     $txt_address = Text::get('invest-address-address-field') . ' ' . $invest->address->address;
     $txt_address .= '<br> ' . Text::get('invest-address-zipcode-field') . ' ' . $invest->address->zipcode;
     //            $txt_address .= '<br> ' . Text::get('invest-address-location-field') . ' ' . $invest->address->location;
     //            $txt_address .= '<br> ' . Text::get('invest-address-country-field') . ' ' . $invest->address->country;
     $txt_destaddr = $txt_address;
     $txt_address = Text::get('invest-mail_info-address') . '<br>' . $txt_address;
     // Agradecimiento al cofinanciador
     // Sustituimos los datos
     $subject = str_replace('%PROJECTNAME%', $projectData->name, $template->title);
     // En el contenido:
     $search = array('%USERNAME%', '%PROJECTNAME%', '%PROJECTURL%', '%AMOUNT%', '%REWARDS%', '%ADDRESS%');
     $replace = array($user->name, $projectData->name, SITE_URL . '/project/' . $projectData->id, $confirm->amount, $txt_rewards, $txt_address);
     $content = \str_replace($search, $replace, $template->text);
     $mailHandler = new Mail();
     $mailHandler->reply = GOTEO_CONTACT_MAIL;
     $mailHandler->replyName = GOTEO_MAIL_NAME;
     $mailHandler->to = $user->email;
     $mailHandler->toName = $user->name;
     $mailHandler->subject = $subject;
     $mailHandler->content = $content;
     $mailHandler->html = true;
     $mailHandler->template = $template->id;
     if ($mailHandler->send($errors)) {
         Message::Info(Text::get('project-invest-thanks_mail-success'));
     } else {
         Message::Error(Text::get('project-invest-thanks_mail-fail'));
         Message::Error(implode('<br />', $errors));
//.........这里部分代码省略.........
开发者ID:kenjs,项目名称:Goteo,代码行数:101,代码来源:invest.php


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