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


PHP DAOFactory类代码示例

本文整理汇总了PHP中DAOFactory的典型用法代码示例。如果您正苦于以下问题:PHP DAOFactory类的具体用法?PHP DAOFactory怎么用?PHP DAOFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: __construct

 function __construct()
 {
     global $configs;
     $this->baseUrl = $configs["COLLAP_BASE_URL"];
     $this->jobsBaseUrl = $configs["JOBS_COLLAP_BASE_URL"];
     $this->url = rtrim($this->baseUrl, "/") . $_SERVER[REQUEST_URI];
     global $logger;
     $this->logger = $logger;
     $this->logger->debug("RecoverPasswordController started");
     $DAOFactory = new DAOFactory();
     $this->userInfoDAO = $DAOFactory->getUserInfoDAO();
     $this->userAccessAidDAO = $DAOFactory->getUserAccessAidDAO();
 }
开发者ID:rajnishp,项目名称:teamroomV3,代码行数:13,代码来源:RecoverPasswordController.class.php

示例2: __construct

 function __construct()
 {
     global $configs;
     $this->baseUrl = $configs["BLUETEAM_BASE_URL"];
     $this->agentBaseUrl = $configs["BLUETEAM_AGENT_BASE_URL"];
     $this->url = rtrim($this->baseUrl, "/") . $_SERVER[REQUEST_URI];
     global $logger;
     $this->logger = $logger;
     $this->logger->debug("BaseController started");
     if (isset($_SESSION["uuid"])) {
         $this->uuid = $_SESSION["uuid"];
         $this->username = $_SESSION["username"];
         $this->firstName = $_SESSION['first_name'];
         $this->lastName = $_SESSION['last_name'];
     }
     $DAOFactory = new DAOFactory();
     $this->employeeDAO = $DAOFactory->getEmployeesDAO();
     $this->workerDAO = $DAOFactory->getWorkersDAO();
     $this->serviceRequestDAO = $DAOFactory->getServiceRequestDAO();
     $this->agentDAO = $DAOFactory->getAgentDAO();
     $this->getInTouchDAO = $DAOFactory->getInTouchDAO();
     $this->userDAO = $DAOFactory->getUsersDAO();
     $this->serviceDAO = $DAOFactory->getServicesDAO();
     $this->process();
 }
开发者ID:rajnishp,项目名称:bjsadmin,代码行数:25,代码来源:BaseController.class.php

示例3: getAuthParameters

 /**
  * Returns URL-encoded parameters needed to make an API call.
  * @param str $username
  * @return str Parameters to use in a URL to make an API call
  */
 public static function getAuthParameters($username)
 {
     $owner_dao = DAOFactory::getDAO('OwnerDAO');
     $pwd_from_db = $owner_dao->getPass($username);
     $api_secret = Session::getAPISecretFromPassword($pwd_from_db);
     return 'un=' . urlencode($username) . '&as=' . urlencode($api_secret);
 }
开发者ID:rayyan,项目名称:ThinkUp,代码行数:12,代码来源:class.ThinkUpAuthAPIController.php

示例4: control

 public function control()
 {
     $this->redirectToSternIndiaEndpoint('forgot.php');
     $config = Config::getInstance();
     //$this->addToView('is_registration_open', $config->getValue('is_registration_open'));
     // if (isset($_POST['email']) && $_POST['Submit'] == 'Send Reset') {
     // /$_POST['email'] = 'prabhat@sternindia.com';
     if (isset($_POST['email'])) {
         $this->disableCaching();
         $dao = DAOFactory::getDAO('UserDAO');
         $user = $dao->getByEmail($_POST['email']);
         if (isset($user)) {
             $token = $user->setPasswordRecoveryToken();
             $es = new ViewManager();
             $es->caching = false;
             //$es->assign('apptitle', $config->getValue('app_title_prefix')."ThinkUp" );
             $es->assign('first_name', $user->first_name);
             $es->assign('recovery_url', "session/reset.php?token={$token}");
             $es->assign('application_url', Utils::getApplicationURL(false));
             $es->assign('site_root_path', $config->getValue('site_root_path'));
             $message = $es->fetch('_email.forgotpassword.tpl');
             $subject = $config->getValue('app_title_prefix') . "Stern India Password Recovery";
             //Will put the things in queue to mail the things.
             Resque::enqueue('user_mail', 'Mailer', array($_POST['email'], $subject, $message));
             $this->addToView('link_sent', true);
         } else {
             $this->addErrorMessage('Error: account does not exist.');
         }
     }
     $this->setViewTemplate('Session/forgot.tpl');
     return $this->generateView();
 }
开发者ID:prabhatse,项目名称:olx_hack,代码行数:32,代码来源:class.ForgotPasswordController.php

示例5: control

 public function control()
 {
     $output = "";
     $authorized = false;
     if (isset($this->argc) && $this->argc > 1) {
         // check for CLI credentials
         $session = new Session();
         $username = $this->argv[1];
         if ($this->argc > 2) {
             $pw = $this->argv[2];
         } else {
             $pw = getenv('THINKUP_PASSWORD');
         }
         $owner_dao = DAOFactory::getDAO('OwnerDAO');
         $owner = $owner_dao->getByEmail($username);
         if ($owner_dao->isOwnerAuthorized($username, $pw)) {
             $authorized = true;
             Session::completeLogin($owner);
         } else {
             $output = "ERROR: Incorrect username and password.";
         }
     } else {
         // check user is logged in on the web
         if ($this->isLoggedIn()) {
             $authorized = true;
         } else {
             $output = "ERROR: Invalid or missing username and password.";
         }
     }
     if ($authorized) {
         $crawler = Crawler::getInstance();
         $crawler->crawl();
     }
     return $output;
 }
开发者ID:rgroves,项目名称:ThinkUp,代码行数:35,代码来源:class.CrawlerAuthController.php

示例6: control

 public function control()
 {
     $config = Config::getInstance();
     $this->addToView('is_registration_open', $config->getValue('is_registration_open'));
     if (isset($_POST['Submit']) && $_POST['Submit'] == 'Send Reset') {
         $this->disableCaching();
         $dao = DAOFactory::getDAO('OwnerDAO');
         $user = $dao->getByEmail($_POST['email']);
         if (isset($user)) {
             $token = $user->setPasswordRecoveryToken();
             $es = new ViewManager();
             $es->caching = false;
             $es->assign('apptitle', $config->getValue('app_title_prefix') . "ThinkUp");
             $es->assign('recovery_url', "session/reset.php?token={$token}");
             $es->assign('application_url', Utils::getApplicationURL($false));
             $es->assign('site_root_path', $config->getValue('site_root_path'));
             $message = $es->fetch('_email.forgotpassword.tpl');
             Mailer::mail($_POST['email'], $config->getValue('app_title_prefix') . "ThinkUp Password Recovery", $message);
             $this->addSuccessMessage('Password recovery information has been sent to your email address.');
         } else {
             $this->addErrorMessage('Error: account does not exist.');
         }
     }
     $this->view_mgr->addHelp('forgot', 'userguide/accounts/index');
     $this->setViewTemplate('session.forgot.tpl');
     return $this->generateView();
 }
开发者ID:kuthulas,项目名称:ProjectX,代码行数:27,代码来源:class.ForgotPasswordController.php

示例7: generateInsight

 public function generateInsight(Instance $instance, $last_week_of_posts, $number_days)
 {
     parent::generateInsight($instance, $last_week_of_posts, $number_days);
     $this->logger->logInfo("Begin generating insight", __METHOD__ . ',' . __LINE__);
     //Set up DAOs
     $instance_hashtag_dao = DAOFactory::getDAO('InstanceHashtagDAO');
     $hashtag_post_dao = DAOFactory::getDAO('HashtagPostDAO');
     $hashtag_dao = DAOFactory::getDAO('HashtagDAO');
     // Get all the hashtags for the instance
     $instance_hashtags = $instance_hashtag_dao->getByInstance($instance->id);
     // foreach hashtag, get the count of new posts
     foreach ($instance_hashtags as $instance_hashtag) {
         $total_new_posts = $hashtag_post_dao->getTotalPostsByHashtagAndDate($instance_hashtag->hashtag_id);
         //Only insert insight if there are new results
         if ($total_new_posts > 0) {
             //Assemble insight text
             $post_term = $instance->network == 'twitter' ? 'tweets' : 'posts';
             $hashtag = $hashtag_dao->getHashtagByID($instance_hashtag->hashtag_id);
             $link = 'search.php?u=' . $instance->network_username . '&n=' . $instance->network . '&c=searches&k=' . urlencode($hashtag->hashtag) . '&q=' . urlencode($hashtag->hashtag);
             $text = number_format($total_new_posts) . " new " . $post_term . " contain <b><a href=\"" . $link . "\">" . $hashtag->hashtag . "</a></b>.";
             // Insert insight
             $this->insight_dao->insertInsightDeprecated("saved_search_results_" . $instance_hashtag->hashtag_id, $instance->id, $this->insight_date, "New search results:", $text, basename(__FILE__, ".php"), Insight::EMPHASIS_MED);
         }
     }
     $this->logger->logInfo("Done generating insight", __METHOD__ . ',' . __LINE__);
 }
开发者ID:dgw,项目名称:ThinkUp,代码行数:26,代码来源:savedsearchresults.php

示例8: testValidResults

 public function testValidResults()
 {
     // one result
     $builders = $this->buildOptions(1);
     $post_dao = DAOFactory::getDAO('PostDAO');
     $post_it = $post_dao->getAllPostsByUsernameIterator('mojojojo', 'twitter');
     $posts = $post_dao->getAllPostsByUsername('mojojojo', 'twitter');
     $cnt = 0;
     foreach ($post_it as $key => $value) {
         $this->assertEqual($value->post_text, $posts[$cnt]->post_text);
         $this->assertIsA($value, 'Post');
         $cnt++;
     }
     $this->assertEqual(1, $cnt);
     // 10 results
     $builders = null;
     $builders = $this->buildOptions(10);
     $post_it = $post_dao->getAllPostsByUsernameIterator('mojojojo', 'twitter');
     $posts = $post_dao->getAllPostsByUsername('mojojojo', 'twitter');
     $cnt = 0;
     foreach ($post_it as $key => $value) {
         $this->assertEqual($value->post_text, $posts[$cnt]->post_text);
         $this->assertIsA($value, 'Post');
         $cnt++;
     }
     $this->assertEqual(10, $cnt);
 }
开发者ID:ngugijames,项目名称:ThinkUp,代码行数:27,代码来源:TestOfPostIterator.php

示例9: control

 public function control()
 {
     $session = new Session();
     $dao = DAOFactory::getDAO('OwnerDAO');
     $this->setViewTemplate('session.resetpassword.tpl');
     $this->disableCaching();
     if (!isset($_GET['token']) || !preg_match('/^[\\da-f]{32}$/', $_GET['token']) || !($user = $dao->getByPasswordToken($_GET['token']))) {
         // token is nonexistant or bad
         $this->addErrorMessage('You have reached this page in error.');
         return $this->generateView();
     }
     if (!$user->validateRecoveryToken($_GET['token'])) {
         $this->addErrorMessage('Your token is expired.');
         return $this->generateView();
     }
     if (isset($_POST['password'])) {
         if ($_POST['password'] == $_POST['password_confirm']) {
             if ($dao->updatePassword($user->email, $session->pwdcrypt($_POST['password'])) < 1) {
                 echo "not updated";
             }
             $login_controller = new LoginController(true);
             $login_controller->addSuccessMessage('You have changed your password.');
             return $login_controller->go();
         } else {
             $this->addErrorMessage("Passwords didn't match.");
         }
     } else {
         if (isset($_POST['Submit'])) {
             $this->addErrorMessage('Please enter a new password.');
         }
     }
     return $this->generateView();
 }
开发者ID:rayyan,项目名称:ThinkUp,代码行数:33,代码来源:class.PasswordResetController.php

示例10: crawl

 public function crawl()
 {
     $logger = Logger::getInstance();
     $config = Config::getInstance();
     $instance_dao = DAOFactory::getDAO('InstanceDAO');
     $owner_instance_dao = DAOFactory::getDAO('OwnerInstanceDAO');
     $owner_dao = DAOFactory::getDAO('OwnerDAO');
     $plugin_option_dao = DAOFactory::GetDAO('PluginOptionDAO');
     $options = $plugin_option_dao->getOptionsHash('googleplus', true);
     //get cached
     $current_owner = $owner_dao->getByEmail(Session::getLoggedInUser());
     //crawl Google+ users
     $instances = $instance_dao->getActiveInstancesStalestFirstForOwnerByNetworkNoAuthError($current_owner, 'google+');
     if (isset($options['google_plus_client_id']->option_value) && isset($options['google_plus_client_secret']->option_value)) {
         foreach ($instances as $instance) {
             $logger->setUsername(ucwords($instance->network) . ' | ' . $instance->network_username);
             $logger->logUserSuccess("Starting to collect data for " . $instance->network_username . "'s " . ucwords($instance->network), __METHOD__ . ',' . __LINE__);
             $tokens = $owner_instance_dao->getOAuthTokens($instance->id);
             $access_token = $tokens['oauth_access_token'];
             $refresh_token = $tokens['oauth_access_token_secret'];
             $instance_dao->updateLastRun($instance->id);
             $google_plus_crawler = new GooglePlusCrawler($instance, $access_token);
             $dashboard_module_cacher = new DashboardModuleCacher($instance);
             try {
                 $google_plus_crawler->initializeInstanceUser($options['google_plus_client_id']->option_value, $options['google_plus_client_secret']->option_value, $access_token, $refresh_token, $current_owner->id);
                 $google_plus_crawler->fetchInstanceUserPosts();
             } catch (Exception $e) {
                 $logger->logUserError('EXCEPTION: ' . $e->getMessage(), __METHOD__ . ',' . __LINE__);
             }
             $dashboard_module_cacher->cacheDashboardModules();
             $instance_dao->save($google_plus_crawler->instance, 0, $logger);
             $logger->logUserSuccess("Finished collecting data for " . $instance->network_username . "'s " . ucwords($instance->network), __METHOD__ . ',' . __LINE__);
         }
     }
 }
开发者ID:JWFoxJr,项目名称:ThinkUp,代码行数:35,代码来源:class.GooglePlusPlugin.php

示例11: generateInsight

 public function generateInsight(Instance $instance, $last_week_of_posts, $number_days)
 {
     parent::generateInsight($instance, $last_week_of_posts, $number_days);
     $this->logger->logInfo("Begin generating insight", __METHOD__ . ',' . __LINE__);
     $archived_posts_in_hundreds = intval($instance->total_posts_in_system / 100);
     if ($archived_posts_in_hundreds > 0) {
         $insight_baseline_slug = "archived_posts_" . $archived_posts_in_hundreds;
         $insight_baseline_dao = DAOFactory::getDAO('InsightBaselineDAO');
         if (!$insight_baseline_dao->doesInsightBaselineExist($insight_baseline_slug, $instance->id)) {
             $insight_baseline_dao->insertInsightBaseline($insight_baseline_slug, $instance->id, $archived_posts_in_hundreds);
             $config = Config::getInstance();
             switch ($instance->network) {
                 case "twitter":
                     $posts_term = "tweets";
                     break;
                 case "foursquare":
                     $posts_term = "checkins";
                     break;
                 default:
                     $posts_term = "posts";
             }
             $text = "ThinkUp has captured over <strong>" . number_format($archived_posts_in_hundreds * 100) . ' ' . $posts_term . '</strong> by ' . $this->username . '.';
             $this->insight_dao->insertInsight("archived_posts", $instance->id, $this->insight_date, "Archived:", $text, basename(__FILE__, ".php"), Insight::EMPHASIS_MED);
         }
     }
     $this->logger->logInfo("Done generating insight", __METHOD__ . ',' . __LINE__);
 }
开发者ID:kuthulas,项目名称:ProjectX,代码行数:27,代码来源:archivedposts.php

示例12: testFlickrCrawl

    public function  testFlickrCrawl() {
        $builders = $this->buildData();

        $crawler = Crawler::getInstance();
        $config = Config::getInstance();

        //use fake Flickr API key
        $plugin_builder = FixtureBuilder::build('plugins', array('id'=>'2', 'folder_name'=>'flickrthumbnails'));
        $option_builder = FixtureBuilder::build('options', array(
            'namespace' => OptionDAO::PLUGIN_OPTIONS . '-2',
            'option_name' => 'flickr_api_key',
            'option_value' => 'dummykey') );
        //$config->setValue('flickr_api_key', 'dummykey');

        $this->simulateLogin('admin@example.com', true);
        $crawler->crawl();

        $ldao = DAOFactory::getDAO('LinkDAO');

        $link = $ldao->getLinkById(43);
        $this->assertEqual($link->expanded_url, 'http://farm3.static.flickr.com/2755/4488149974_04d9558212_m.jpg');
        $this->assertEqual($link->error, '');

        $link = $ldao->getLinkById(42);
        $this->assertEqual($link->expanded_url, '');
        $this->assertEqual($link->error, 'No response from Flickr API');

        $link = $ldao->getLinkById(41);
        $this->assertEqual($link->expanded_url, '');
        $this->assertEqual($link->error, 'No response from Flickr API');
    }
开发者ID:rkabir,项目名称:ThinkUp,代码行数:31,代码来源:TestOfFlickrThumbnailsPlugin.php

示例13: defaultAction

 public function defaultAction()
 {
     $memcache = new Memcache();
     $memcache->flush();
     $usuario = new Usuario();
     $daoUsuario = DAOFactory::getUsuarioDAO();
     /** @var $user User */
     $user = UserService::getCurrentUser();
     if (isset($user)) {
         $usuarioBD = $daoUsuario->queryByGoogle($user->getUserId());
         if (!$usuarioBD) {
             // No existe el usuario
             $usuario->google = $user->getUserId();
             $usuario->correo = $user->getEmail();
             $usuario->nombre = $user->getNickname();
             $daoUsuario->insert($usuario);
         } else {
             $usuario = $usuarioBD;
         }
         $_SESSION['logoutUrl'] = UserService::createLogoutUrl('/index/closeSession');
         $_SESSION['usuario'] = $usuario;
         include 'vod/index.php';
     } else {
         $this->login();
     }
 }
开发者ID:roberto-pina,项目名称:ventana-educativa,代码行数:26,代码来源:IndexController.class.php

示例14: control

 public function control()
 {
     $this->view_name = isset($_GET['v']) ? $_GET['v'] : 'default';
     $post_dao = DAOFactory::getDAO('PostDAO');
     $this->setPageTitle('Post Details');
     $this->setViewTemplate('post.index.tpl');
     $network = isset($_GET['n']) ? $_GET['n'] : 'twitter';
     if ($this->shouldRefreshCache()) {
         if (isset($_GET['t']) && is_numeric($_GET['t'])) {
             $post_id = $_GET['t'];
             $post = $post_dao->getPost($post_id, $network);
             if (isset($post)) {
                 $config = Config::getInstance();
                 $this->addToView('disable_embed_code', $config->getValue('is_embed_disabled') || $post->is_protected);
                 if (isset($_GET['search'])) {
                     $this->addToView('search_on', true);
                 }
                 if (!$post->is_protected || $this->isLoggedIn()) {
                     $plugin_option_dao = DAOFactory::GetDAO('PluginOptionDAO');
                     $options = $plugin_option_dao->getOptionsHash('geoencoder', true);
                     if (isset($options['distance_unit']->option_value)) {
                         $distance_unit = $options['distance_unit']->option_value;
                     } else {
                         $distance_unit = 'km';
                     }
                     $this->addToView('post', $post);
                     $this->addToView('unit', $distance_unit);
                     $replies = $post_dao->getRepliesToPost($post_id, $network, 'default', $distance_unit);
                     $public_replies = array();
                     foreach ($replies as $reply) {
                         if (!$reply->author->is_protected) {
                             $public_replies[] = $reply;
                         }
                     }
                     $public_replies_count = count($public_replies);
                     $this->addToView('public_reply_count', $public_replies_count);
                     if ($this->isLoggedIn()) {
                         $this->addToView('replies', $replies);
                     } else {
                         $this->addToView('replies', $public_replies);
                     }
                     $all_replies_count = count($replies);
                     $private_reply_count = $all_replies_count - $public_replies_count;
                     $this->addToView('private_reply_count', $private_reply_count);
                     $webapp = Webapp::getInstance();
                     $sidebar_menu = $webapp->getPostDetailMenu($post);
                     $this->addToView('sidebar_menu', $sidebar_menu);
                     $this->loadView($post);
                 } else {
                     $this->addErrorMessage('Insufficient privileges');
                 }
             } else {
                 $this->addErrorMessage('Post not found');
             }
         } else {
             $this->addErrorMessage('Post not specified');
         }
     }
     return $this->generateView();
 }
开发者ID:raycornelius,项目名称:ThinkUp,代码行数:60,代码来源:class.PostController.php

示例15: generateInsight

 public function generateInsight(Instance $instance, $last_week_of_posts, $number_days)
 {
     parent::generateInsight($instance, $last_week_of_posts, $number_days);
     $this->logger->logInfo("Begin generating insight", __METHOD__ . ',' . __LINE__);
     if (self::shouldGenerateInsight('link_prompt', $instance, $insight_date = 'today', $regenerate_existing_insight = false, $day_of_week = null, $count_last_week_of_posts = null, $excluded_networks = array('foursquare', 'youtube'), $alternate_day = (int) date('j') % 2)) {
         $post_dao = DAOFactory::getDAO('PostDAO');
         $link_dao = DAOFactory::getDAO('LinkDAO');
         // Check from midnight two days ago until an hour from now
         // (to avoid clock-sync issues)
         $recent_posts = $post_dao->getPostsByUserInRange($instance->network_user_id, $instance->network, date('Y-m-d H:i:s', strtotime('-2 days midnight')), date('Y-m-d H:i:s', strtotime('+1 hour')));
         $posts_with_links = array();
         foreach ($recent_posts as $post) {
             $post_text = $post->post_text;
             $text_parser = new Twitter_Extractor($post_text);
             $elements = $text_parser->extract();
             if (count($elements['urls'])) {
                 $posts_with_links[] = $post;
             }
         }
         $num_posts = $post_dao->countAllPostsByUserSinceDaysAgo($instance->network_user_id, $instance->network, 30);
         $num_links = $link_dao->countLinksPostedByUserSinceDaysAgo($instance->network_user_id, $instance->network, 30);
         if ($num_posts && $num_links / $num_posts > 0.2 && count($recent_posts) && !count($posts_with_links)) {
             $insight_text = $this->username . " hasn't " . $this->terms->getVerb('posted') . " a link in the last 2 days. It may be time to share an interesting link with " . $this->terms->getNoun('friend', InsightTerms::PLURAL) . ".";
             $this->insight_dao->insertInsightDeprecated('link_prompt', $instance->id, $this->insight_date, "Nudge:", $insight_text, basename(__FILE__, ".php"), Insight::EMPHASIS_LOW);
         }
     }
     $this->logger->logInfo("Done generating insight", __METHOD__ . ',' . __LINE__);
 }
开发者ID:dgw,项目名称:ThinkUp,代码行数:28,代码来源:linkprompt.php


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