function LoadPageSection($section) { if (!isset($_SESSION['selectedCamera'])) { echo "No Camera Selected"; return; } $cam = Cameras::SelectedCamera(); $params = isset($_GET['params']) ? $_GET["params"] : ''; switch ($section) { case "info": Section_Info($cam); break; case "take": Section_Take($cam); break; case "log": Section_Log(); break; case "commands": Section_Commands(); break; case "browse": Section_Browse($cam); break; case "getconfigrow": Section_ConfigRow($cam); break; case "imagesettings": Section_ImageSettings($cam); break; case "capturesettings": Section_CaptureSettings($cam, false); break; } }
public static function loadCameras() { if (!self::$loaded) { $retval = shell_exec('gphoto2 --auto-detect'); $cams = explode("\n", $retval); if (count($cams) <= 3) { unset($_SESSION['selectedCamera']); return; } if (isset($_SESSION['selectedCamera'])) { if (strpos($retval, $_SESSION['selectedCamera']) === false) { unset($_SESSION['selectedCamera']); } } for ($i = 2; $i < count($cams); $i++) { $cameraPort = ""; $cameraName = ""; $IsUSB = strrpos($cams[$i], "usb:"); $IsSerial = strrpos($cams[$i], "serial:"); if ($IsUSB !== false) { $cameraName = trim(substr($cams[$i], 0, $IsUSB)); $cameraPort = trim(substr($cams[$i], $IsUSB, strlen($cams[$i]) - $IsUSB)); } else { if ($IsSerial !== false) { $cameraName = trim(substr($cams[$i], 0, $IsSerial)); $cameraPort = trim(substr($cams[$i], $IsSerial, strlen($cams[$i]) - $IsSerial)); } } $newcam = null; if (apc_exists($cameraPort)) { $newcam = unserialize(apc_fetch($cameraPort)); } else { if ($i == 2 && !isset($_SESSION['selectedCamera'])) { $_SESSION['selectedCamera'] = $cameraPort; } if (strlen($cameraName) > 0) { $newcam = new Camera($cameraPort, $cameraName); apc_store($cameraPort, serialize($newcam)); } } if ($newcam != null) { self::$cameras[] = $newcam; } } self::$loaded = true; } }
} ?> ><a href="?p=take">Take</a></li> <li ><a href="#" data-toggle="modal" data-target="#photopopupmodal" onclick="showLatest(false)">Latest</a></li> <li <?php if ($selMenu == "browse") { echo 'class="active"'; } ?> ><a href="?p=browse">Browse</a></li> </ul> </div> </div> </nav> <?php $cam = Cameras::SelectedCamera(); if ($cam != null && $cam->Timelapse != null) { $ct = $cam->Timelapse; ?> <script type="text/javascript"> $(function() { setTimelapseProgress(<?php echo $ct->Done(); ?> , <?php echo $ct->Count; ?> );}); </script> <?php } ?>
function SelectedCameraName() { $cam = Cameras::SelectedCamera(); if ($cam == null) { return "No Camera selected"; } return $cam->Name; }