public static function getInstance() { if (!isset(self::$classInstance)) { self::$classInstance = new self(); } return self::$classInstance; }
public static function setupScheduler($photos = null, $albums = null, $album_id = 0, $params = array()) { $user_id = OW::getUser()->getId(); $aScheduler = array(); $aScheduler['owner_id'] = $user_id; $aScheduler['owner_type'] = 'user'; $aScheduler['user_id'] = $user_id; $aScheduler['params'] = json_encode($params); $scheduler = YNMEDIAIMPORTER_BOL_SchedulerService::getInstance()->addScheduler($aScheduler); $schedulerId = $scheduler->id; $nodeId = array(); $album_id = intval($album_id); if (is_array($albums) && !empty($albums)) { foreach ($albums as $id) { $nodeId[] = "'" . $id . "'"; } } if (is_array($photos) && !empty($photos)) { foreach ($photos as $id) { $nodeId[] = "'" . $id . "'"; } } $nodeId = implode(',', $nodeId); $nodeTableName = OW_DB_PREFIX . 'ynmediaimporter_nodes'; $sql = "UPDATE `{$nodeTableName}` SET "; $sql .= "`scheduler_id` = {$schedulerId}, "; $sql .= "`user_aid` = {$album_id}, "; $sql .= "`status` = 1 "; // in schdule $sql .= "where nid IN ({$nodeId}) and user_id = '{$user_id}' and `status` < 3"; OW::getDbo()->query($sql); return $schedulerId; }